JWT Groups support (#966)

Get groups from the JWT tokens if the feature enabled for the account
This commit is contained in:
Givi Khojanashvili
2023-06-27 18:51:05 +04:00
committed by GitHub
parent ed075bc9b9
commit 8b619a8224
14 changed files with 317 additions and 23 deletions

View File

@@ -54,6 +54,14 @@ components:
description: Period of time after which peer login expires (seconds).
type: integer
example: 43200
jwt_groups_enabled:
description: Allows extract groups from JWT claim and add it to account groups.
type: boolean
example: true
jwt_groups_claim_name:
description: Name of the claim from which we extract groups names to add it to account groups.
type: string
example: "roles"
required:
- peer_login_expiration_enabled
- peer_login_expiration
@@ -462,6 +470,10 @@ components:
description: Count of peers associated to the group
type: integer
example: 2
issued:
description: How group was issued by API or from JWT token
type: string
example: api
required:
- id
- name

View File

@@ -129,6 +129,12 @@ type AccountRequest struct {
// AccountSettings defines model for AccountSettings.
type AccountSettings struct {
// JwtGroupsClaimName Name of the claim from which we extract groups names to add it to account groups.
JwtGroupsClaimName *string `json:"jwt_groups_claim_name,omitempty"`
// JwtGroupsEnabled Allows extract groups from JWT claim and add it to account groups.
JwtGroupsEnabled *bool `json:"jwt_groups_enabled,omitempty"`
// PeerLoginExpiration Period of time after which peer login expires (seconds).
PeerLoginExpiration int `json:"peer_login_expiration"`
@@ -174,6 +180,9 @@ type Group struct {
// Id Group ID
Id string `json:"id"`
// Issued How group was issued by API or from JWT token
Issued *string `json:"issued,omitempty"`
// Name Group Name identifier
Name string `json:"name"`
@@ -189,6 +198,9 @@ type GroupMinimum struct {
// Id Group ID
Id string `json:"id"`
// Issued How group was issued by API or from JWT token
Issued *string `json:"issued,omitempty"`
// Name Group Name identifier
Name string `json:"name"`