OIDC: add support for account claim maps (#1186)

This commit is contained in:
Jim authored and GitHub committed 2021-05-04 08:41:04 -04:00
1 parent 4ae5003763
commit 2437cdcc8d
28 files changed
+1456 -200

No files matched your search

@@ -123,6 +123,13 @@ message OidcAuthMethodAttributes {
repeated string claims_scopes = 112
[json_name = "claims_scopes", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.claims_scopes" that: "ClaimsScopes" }];
// account_claim_maps are optional claim maps from custom claims to the
// standard claims of sub, name and email. These maps are represented as
// key=value where the key equals the from_claim and the value equals the
// to_claim. For example "oid=sub".
repeated string account_claim_maps = 113
[json_name = "account_claim_maps", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.account_claim_maps" that: "AccountClaimMaps" }];
// If the Authorization Server's discovered configuration contains values
// that do not match the configuration set on this auth method, this can be
// set to force the local configuration to override the discovered values.
@@ -117,6 +117,13 @@ message AuthMethod {
// are operatated on as a complete set.
// @inject_tag: `gorm:"-"`
repeated string claims_scopes = 200 [(custom_options.v1.mask_mapping) = { this: "ClaimsScopes" that: "attributes.claims_scopes" }];
// account_claim_maps are optional claim maps from custom claims to the
// standard claims of sub, name and email. These maps are represented as
// key=value where the key equals the from_claim and the value equals the
// to_claim. For example "oid=sub".
// @inject_tag: `gorm:"-"`
repeated string account_claim_maps = 210 [(custom_options.v1.mask_mapping) = { this: "AccountClaimMaps" that: "attributes.account_claim_maps" }];
}
// Account represents an OIDC account
@@ -224,4 +231,24 @@ message ClaimsScope {
// The create_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp create_time = 30;
}
// AccountClaimMap entries are optional from/to account claim maps.
message AccountClaimMap {
// @inject_tag: `gorm:"primary_key"`
string oidc_method_id = 10;
// from_claim is the claim from the id_token that you need to map to a
// standard account claim.
// @inject_tag: `gorm:"not_null"`
string from_claim = 20;
// to_claim is the standard account claim to map the from_claim to. Valid
// values are: sub, name, email
// @inject_tag: `gorm:"column:to_claim;primary_key"`
string to_claim = 30;
// The create_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp create_time = 40;
}