mirror of
https://github.com/andwati/zitadel.git
synced 2026-12-04 01:48:50 +00:00
feat(saml): allow setting nameid-format and alternative mapping for transient format (#7979)
# Which Problems Are Solved ZITADEL currently always uses `urn:oasis:names:tc:SAML:2.0:nameid-format:persistent` in SAML requests, relying on the IdP to respect that flag and always return a peristent nameid in order to be able to map the external user with an existing user (idp link) in ZITADEL. In case the IdP however returns a `urn:oasis:names:tc:SAML:2.0:nameid-format:transient` (transient) nameid, the attribute will differ between each request and it will not be possible to match existing users. # How the Problems Are Solved This PR adds the following two options on SAML IdP: - **nameIDFormat**: allows to set the nameid-format used in the SAML Request - **transientMappingAttributeName**: allows to set an attribute name, which will be used instead of the nameid itself in case the returned nameid-format is transient # Additional Changes To reduce impact on current installations, the `idp_templates6_saml` table is altered with the two added columns by a setup job. New installations will automatically get the table with the two columns directly. All idp unit tests are updated to use `expectEventstore` instead of the deprecated `eventstoreExpect`. # Additional Context Closes #7483 Closes #7743 --------- Co-authored-by: peintnermax <[email protected]> Co-authored-by: Stefan Benz <[email protected]>
This commit is contained in:
co-authored by
peintnermax
Stefan Benz
parent
12be21a3ff
commit
e57a9b57c8
@@ -0,0 +1,27 @@
|
|||||||
|
package setup
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
|
"github.com/zitadel/zitadel/internal/database"
|
||||||
|
"github.com/zitadel/zitadel/internal/eventstore"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
//go:embed 27.sql
|
||||||
|
addSAMLNameIDFormat string
|
||||||
|
)
|
||||||
|
|
||||||
|
type IDPTemplate6SAMLNameIDFormat struct {
|
||||||
|
dbClient *database.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mig *IDPTemplate6SAMLNameIDFormat) Execute(ctx context.Context, _ eventstore.Event) error {
|
||||||
|
_, err := mig.dbClient.ExecContext(ctx, addSAMLNameIDFormat)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mig *IDPTemplate6SAMLNameIDFormat) String() string {
|
||||||
|
return "26_idp_templates6_add_saml_name_id_format"
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE IF EXISTS projections.idp_templates6_saml ADD COLUMN IF NOT EXISTS name_id_format SMALLINT;
|
||||||
|
ALTER TABLE IF EXISTS projections.idp_templates6_saml ADD COLUMN IF NOT EXISTS transient_mapping_attribute_name TEXT;
|
||||||
@@ -109,6 +109,7 @@ type Steps struct {
|
|||||||
s24AddActorToAuthTokens *AddActorToAuthTokens
|
s24AddActorToAuthTokens *AddActorToAuthTokens
|
||||||
s25User11AddLowerFieldsToVerifiedEmail *User11AddLowerFieldsToVerifiedEmail
|
s25User11AddLowerFieldsToVerifiedEmail *User11AddLowerFieldsToVerifiedEmail
|
||||||
s26AuthUsers3 *AuthUsers3
|
s26AuthUsers3 *AuthUsers3
|
||||||
|
s27IDPTemplate6SAMLNameIDFormat *IDPTemplate6SAMLNameIDFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
func MustNewSteps(v *viper.Viper) *Steps {
|
func MustNewSteps(v *viper.Viper) *Steps {
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ func Setup(config *Config, steps *Steps, masterKey string) {
|
|||||||
steps.s24AddActorToAuthTokens = &AddActorToAuthTokens{dbClient: queryDBClient}
|
steps.s24AddActorToAuthTokens = &AddActorToAuthTokens{dbClient: queryDBClient}
|
||||||
steps.s25User11AddLowerFieldsToVerifiedEmail = &User11AddLowerFieldsToVerifiedEmail{dbClient: esPusherDBClient}
|
steps.s25User11AddLowerFieldsToVerifiedEmail = &User11AddLowerFieldsToVerifiedEmail{dbClient: esPusherDBClient}
|
||||||
steps.s26AuthUsers3 = &AuthUsers3{dbClient: esPusherDBClient}
|
steps.s26AuthUsers3 = &AuthUsers3{dbClient: esPusherDBClient}
|
||||||
|
steps.s27IDPTemplate6SAMLNameIDFormat = &IDPTemplate6SAMLNameIDFormat{dbClient: esPusherDBClient}
|
||||||
|
|
||||||
err = projection.Create(ctx, projectionDBClient, eventstoreClient, config.Projections, nil, nil, nil)
|
err = projection.Create(ctx, projectionDBClient, eventstoreClient, config.Projections, nil, nil, nil)
|
||||||
logging.OnError(err).Fatal("unable to start projections")
|
logging.OnError(err).Fatal("unable to start projections")
|
||||||
@@ -190,6 +191,7 @@ func Setup(config *Config, steps *Steps, masterKey string) {
|
|||||||
steps.s18AddLowerFieldsToLoginNames,
|
steps.s18AddLowerFieldsToLoginNames,
|
||||||
steps.s21AddBlockFieldToLimits,
|
steps.s21AddBlockFieldToLimits,
|
||||||
steps.s25User11AddLowerFieldsToVerifiedEmail,
|
steps.s25User11AddLowerFieldsToVerifiedEmail,
|
||||||
|
steps.s27IDPTemplate6SAMLNameIDFormat,
|
||||||
} {
|
} {
|
||||||
mustExecuteMigration(ctx, eventstoreClient, step, "migration failed")
|
mustExecuteMigration(ctx, eventstoreClient, step, "migration failed")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.option-form {
|
.option-form {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
max-width: 400px;
|
max-width: 500px;
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
|
|
||||||
.checkbox-desc {
|
.checkbox-desc {
|
||||||
|
|||||||
@@ -70,6 +70,28 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showOptional">
|
<div *ngIf="showOptional">
|
||||||
|
<div class="transient-info">
|
||||||
|
<cnsl-form-field class="formfield">
|
||||||
|
<cnsl-label>{{ 'IDP.SAML.NAMEIDFORMAT' | translate }}</cnsl-label>
|
||||||
|
<mat-select formControlName="nameIdFormat" [compareWith]="compareNameIDFormat">
|
||||||
|
<mat-option *ngFor="let nameIdFormat of nameIDFormatValues" [value]="nameIdFormat">{{
|
||||||
|
nameIdFormat
|
||||||
|
}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</cnsl-form-field>
|
||||||
|
|
||||||
|
<cnsl-info-section>
|
||||||
|
<div>
|
||||||
|
<p class="transient-info-desc">{{ 'IDP.SAML.TRANSIENTMAPPINGATTRIBUTENAME_DESC' | translate }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<cnsl-form-field class="formfield">
|
||||||
|
<cnsl-label>{{ 'IDP.SAML.TRANSIENTMAPPINGATTRIBUTENAME' | translate }}</cnsl-label>
|
||||||
|
<input cnslInput formControlName="transientMappingAttributeName" />
|
||||||
|
</cnsl-form-field>
|
||||||
|
</cnsl-info-section>
|
||||||
|
</div>
|
||||||
|
|
||||||
<cnsl-provider-options
|
<cnsl-provider-options
|
||||||
[initialOptions]="provider?.config?.options"
|
[initialOptions]="provider?.config?.options"
|
||||||
(optionsChanged)="options = $event"
|
(optionsChanged)="options = $event"
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
.metadata-xml {
|
.metadata-xml {
|
||||||
min-height: 200px;
|
min-height: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.transient-info {
|
||||||
|
max-width: 500px;
|
||||||
|
|
||||||
|
.transient-info-desc {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import { Component, Injector, Type } from '@angular/core';
|
import { Component, Injector, Type } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { AutoLinkingOption, Options, Provider, SAMLBinding } from '../../../proto/generated/zitadel/idp_pb';
|
import {
|
||||||
|
AutoLinkingOption,
|
||||||
|
Options,
|
||||||
|
Provider,
|
||||||
|
SAMLBinding,
|
||||||
|
SAMLNameIDFormat,
|
||||||
|
} from '../../../proto/generated/zitadel/idp_pb';
|
||||||
import { AbstractControl, FormGroup, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
import { AbstractControl, FormGroup, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||||
import { PolicyComponentServiceType } from '../../policies/policy-component-types.enum';
|
import { PolicyComponentServiceType } from '../../policies/policy-component-types.enum';
|
||||||
import { ManagementService } from '../../../services/mgmt.service';
|
import { ManagementService } from '../../../services/mgmt.service';
|
||||||
@@ -46,6 +52,7 @@ export class ProviderSamlSpComponent {
|
|||||||
// DEPRECATED: use service$ instead
|
// DEPRECATED: use service$ instead
|
||||||
private service!: ManagementService | AdminService;
|
private service!: ManagementService | AdminService;
|
||||||
bindingValues: string[] = Object.keys(SAMLBinding);
|
bindingValues: string[] = Object.keys(SAMLBinding);
|
||||||
|
nameIDFormatValues: string[] = Object.keys(SAMLNameIDFormat);
|
||||||
|
|
||||||
public justCreated$: BehaviorSubject<string> = new BehaviorSubject<string>('');
|
public justCreated$: BehaviorSubject<string> = new BehaviorSubject<string>('');
|
||||||
public justActivated$ = new BehaviorSubject<boolean>(false);
|
public justActivated$ = new BehaviorSubject<boolean>(false);
|
||||||
@@ -118,6 +125,8 @@ export class ProviderSamlSpComponent {
|
|||||||
metadataUrl: new UntypedFormControl('', []),
|
metadataUrl: new UntypedFormControl('', []),
|
||||||
binding: new UntypedFormControl(this.bindingValues[0], [requiredValidator]),
|
binding: new UntypedFormControl(this.bindingValues[0], [requiredValidator]),
|
||||||
withSignedRequest: new UntypedFormControl(true, [requiredValidator]),
|
withSignedRequest: new UntypedFormControl(true, [requiredValidator]),
|
||||||
|
nameIdFormat: new UntypedFormControl(SAMLNameIDFormat.SAML_NAME_ID_FORMAT_PERSISTENT, []),
|
||||||
|
transientMappingAttributeName: new UntypedFormControl('', []),
|
||||||
},
|
},
|
||||||
atLeastOneIsFilled('metadataXml', 'metadataUrl'),
|
atLeastOneIsFilled('metadataXml', 'metadataUrl'),
|
||||||
);
|
);
|
||||||
@@ -196,8 +205,12 @@ export class ProviderSamlSpComponent {
|
|||||||
req.setWithSignedRequest(this.withSignedRequest?.value);
|
req.setWithSignedRequest(this.withSignedRequest?.value);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
req.setBinding(SAMLBinding[this.binding?.value]);
|
req.setBinding(SAMLBinding[this.binding?.value]);
|
||||||
|
// @ts-ignore
|
||||||
|
req.setNameIdFormat(SAMLNameIDFormat[this.nameIDFormat?.value]);
|
||||||
|
req.setTransientMappingAttributeName(this.transientMapping?.value);
|
||||||
req.setProviderOptions(this.options);
|
req.setProviderOptions(this.options);
|
||||||
|
|
||||||
|
console.log(req);
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.service
|
this.service
|
||||||
.updateSAMLProvider(req)
|
.updateSAMLProvider(req)
|
||||||
@@ -229,6 +242,11 @@ export class ProviderSamlSpComponent {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
req.setBinding(SAMLBinding[this.binding?.value]);
|
req.setBinding(SAMLBinding[this.binding?.value]);
|
||||||
req.setWithSignedRequest(this.withSignedRequest?.value);
|
req.setWithSignedRequest(this.withSignedRequest?.value);
|
||||||
|
if (this.nameIDFormat) {
|
||||||
|
// @ts-ignore
|
||||||
|
req.setNameIdFormat(SAMLNameIDFormat[this.nameIDFormat.value]);
|
||||||
|
}
|
||||||
|
req.setTransientMappingAttributeName(this.transientMapping?.value);
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.service
|
this.service
|
||||||
.addSAMLProvider(req)
|
.addSAMLProvider(req)
|
||||||
@@ -279,6 +297,14 @@ export class ProviderSamlSpComponent {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compareNameIDFormat(value: string, index: number) {
|
||||||
|
console.log(value, index);
|
||||||
|
if (value) {
|
||||||
|
return value === Object.keys(SAMLNameIDFormat)[index];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private get name(): AbstractControl | null {
|
private get name(): AbstractControl | null {
|
||||||
return this.form.get('name');
|
return this.form.get('name');
|
||||||
}
|
}
|
||||||
@@ -298,4 +324,12 @@ export class ProviderSamlSpComponent {
|
|||||||
private get withSignedRequest(): AbstractControl | null {
|
private get withSignedRequest(): AbstractControl | null {
|
||||||
return this.form.get('withSignedRequest');
|
return this.form.get('withSignedRequest');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get nameIDFormat(): AbstractControl | null {
|
||||||
|
return this.form.get('nameIdFormat');
|
||||||
|
}
|
||||||
|
|
||||||
|
private get transientMapping(): AbstractControl | null {
|
||||||
|
return this.form.get('transientMappingAttributeName');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
.formfield {
|
.formfield {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 400px;
|
max-width: 500px;
|
||||||
|
|
||||||
&.pwd {
|
&.pwd {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -132,7 +132,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.string-list-component-wrapper {
|
.string-list-component-wrapper {
|
||||||
max-width: 400px;
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.identity-provider-content {
|
.identity-provider-content {
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.identity-provider-2-col {
|
.identity-provider-2-col {
|
||||||
max-width: 400px;
|
max-width: 500px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
column-gap: 1rem;
|
column-gap: 1rem;
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
.flex-line {
|
.flex-line {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
max-width: 400px;
|
max-width: 500px;
|
||||||
|
|
||||||
.formfield {
|
.formfield {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
@@ -2044,7 +2044,7 @@
|
|||||||
"DESCRIPTION": "Enter the credentials for your Apple Provider"
|
"DESCRIPTION": "Enter the credentials for your Apple Provider"
|
||||||
},
|
},
|
||||||
"SAML": {
|
"SAML": {
|
||||||
"TITLE": "Sign in with Saml SP",
|
"TITLE": "Sign in with SAML SP",
|
||||||
"DESCRIPTION": "Enter the credentials for your SAML Provider"
|
"DESCRIPTION": "Enter the credentials for your SAML Provider"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -2177,7 +2177,10 @@
|
|||||||
"METADATAXML": "Metadata Xml",
|
"METADATAXML": "Metadata Xml",
|
||||||
"METADATAURL": "Metadata URL",
|
"METADATAURL": "Metadata URL",
|
||||||
"BINDING": "Binding",
|
"BINDING": "Binding",
|
||||||
"SIGNEDREQUEST": "Signed Request"
|
"SIGNEDREQUEST": "Signed Request",
|
||||||
|
"NAMEIDFORMAT": "NameID Format",
|
||||||
|
"TRANSIENTMAPPINGATTRIBUTENAME": "Custom Mapping Attribute Name",
|
||||||
|
"TRANSIENTMAPPINGATTRIBUTENAME_DESC": "Alternative attribute name to map the user in case the `nameid-format` returned is `transient`, e.g. `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress`"
|
||||||
},
|
},
|
||||||
"TOAST": {
|
"TOAST": {
|
||||||
"SAVED": "Successfully saved.",
|
"SAVED": "Successfully saved.",
|
||||||
|
|||||||
@@ -2044,7 +2044,7 @@
|
|||||||
"DESCRIPTION": "Voer de inloggegevens in voor uw Apple Provider"
|
"DESCRIPTION": "Voer de inloggegevens in voor uw Apple Provider"
|
||||||
},
|
},
|
||||||
"SAML": {
|
"SAML": {
|
||||||
"TITLE": "Log in met Saml SP",
|
"TITLE": "Log in met SAML SP",
|
||||||
"DESCRIPTION": "Voer de inloggegevens in voor uw SAML Provider"
|
"DESCRIPTION": "Voer de inloggegevens in voor uw SAML Provider"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/crewjam/saml"
|
"github.com/crewjam/saml"
|
||||||
|
"github.com/muhlemmer/gu"
|
||||||
|
|
||||||
idp_grpc "github.com/zitadel/zitadel/internal/api/grpc/idp"
|
idp_grpc "github.com/zitadel/zitadel/internal/api/grpc/idp"
|
||||||
"github.com/zitadel/zitadel/internal/api/grpc/object"
|
"github.com/zitadel/zitadel/internal/api/grpc/object"
|
||||||
@@ -469,24 +470,36 @@ func updateAppleProviderToCommand(req *admin_pb.UpdateAppleProviderRequest) comm
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addSAMLProviderToCommand(req *admin_pb.AddSAMLProviderRequest) command.SAMLProvider {
|
func addSAMLProviderToCommand(req *admin_pb.AddSAMLProviderRequest) command.SAMLProvider {
|
||||||
|
var nameIDFormat *domain.SAMLNameIDFormat
|
||||||
|
if req.NameIdFormat != nil {
|
||||||
|
nameIDFormat = gu.Ptr(idp_grpc.SAMLNameIDFormatToDomain(req.GetNameIdFormat()))
|
||||||
|
}
|
||||||
return command.SAMLProvider{
|
return command.SAMLProvider{
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
Metadata: req.GetMetadataXml(),
|
Metadata: req.GetMetadataXml(),
|
||||||
MetadataURL: req.GetMetadataUrl(),
|
MetadataURL: req.GetMetadataUrl(),
|
||||||
Binding: bindingToCommand(req.Binding),
|
Binding: bindingToCommand(req.Binding),
|
||||||
WithSignedRequest: req.WithSignedRequest,
|
WithSignedRequest: req.WithSignedRequest,
|
||||||
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
NameIDFormat: nameIDFormat,
|
||||||
|
TransientMappingAttributeName: req.GetTransientMappingAttributeName(),
|
||||||
|
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateSAMLProviderToCommand(req *admin_pb.UpdateSAMLProviderRequest) command.SAMLProvider {
|
func updateSAMLProviderToCommand(req *admin_pb.UpdateSAMLProviderRequest) command.SAMLProvider {
|
||||||
|
var nameIDFormat *domain.SAMLNameIDFormat
|
||||||
|
if req.NameIdFormat != nil {
|
||||||
|
nameIDFormat = gu.Ptr(idp_grpc.SAMLNameIDFormatToDomain(req.GetNameIdFormat()))
|
||||||
|
}
|
||||||
return command.SAMLProvider{
|
return command.SAMLProvider{
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
Metadata: req.GetMetadataXml(),
|
Metadata: req.GetMetadataXml(),
|
||||||
MetadataURL: req.GetMetadataUrl(),
|
MetadataURL: req.GetMetadataUrl(),
|
||||||
Binding: bindingToCommand(req.Binding),
|
Binding: bindingToCommand(req.Binding),
|
||||||
WithSignedRequest: req.WithSignedRequest,
|
WithSignedRequest: req.WithSignedRequest,
|
||||||
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
NameIDFormat: nameIDFormat,
|
||||||
|
TransientMappingAttributeName: req.GetTransientMappingAttributeName(),
|
||||||
|
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package idp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/crewjam/saml"
|
"github.com/crewjam/saml"
|
||||||
|
"github.com/muhlemmer/gu"
|
||||||
"google.golang.org/protobuf/types/known/durationpb"
|
"google.golang.org/protobuf/types/known/durationpb"
|
||||||
|
|
||||||
obj_grpc "github.com/zitadel/zitadel/internal/api/grpc/object"
|
obj_grpc "github.com/zitadel/zitadel/internal/api/grpc/object"
|
||||||
@@ -339,6 +340,21 @@ func azureADTenantTypeToCommand(tenantType idp_pb.AzureADTenantType) azuread.Ten
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SAMLNameIDFormatToDomain(format idp_pb.SAMLNameIDFormat) domain.SAMLNameIDFormat {
|
||||||
|
switch format {
|
||||||
|
case idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_UNSPECIFIED:
|
||||||
|
return domain.SAMLNameIDFormatUnspecified
|
||||||
|
case idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_EMAIL_ADDRESS:
|
||||||
|
return domain.SAMLNameIDFormatEmailAddress
|
||||||
|
case idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_PERSISTENT:
|
||||||
|
return domain.SAMLNameIDFormatPersistent
|
||||||
|
case idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_TRANSIENT:
|
||||||
|
return domain.SAMLNameIDFormatTransient
|
||||||
|
default:
|
||||||
|
return domain.SAMLNameIDFormatUnspecified
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func ProvidersToPb(providers []*query.IDPTemplate) []*idp_pb.Provider {
|
func ProvidersToPb(providers []*query.IDPTemplate) []*idp_pb.Provider {
|
||||||
list := make([]*idp_pb.Provider, len(providers))
|
list := make([]*idp_pb.Provider, len(providers))
|
||||||
for i, provider := range providers {
|
for i, provider := range providers {
|
||||||
@@ -639,11 +655,17 @@ func appleConfigToPb(providerConfig *idp_pb.ProviderConfig, template *query.Appl
|
|||||||
}
|
}
|
||||||
|
|
||||||
func samlConfigToPb(providerConfig *idp_pb.ProviderConfig, template *query.SAMLIDPTemplate) {
|
func samlConfigToPb(providerConfig *idp_pb.ProviderConfig, template *query.SAMLIDPTemplate) {
|
||||||
|
nameIDFormat := idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_PERSISTENT
|
||||||
|
if template.NameIDFormat.Valid {
|
||||||
|
nameIDFormat = nameIDToPb(template.NameIDFormat.V)
|
||||||
|
}
|
||||||
providerConfig.Config = &idp_pb.ProviderConfig_Saml{
|
providerConfig.Config = &idp_pb.ProviderConfig_Saml{
|
||||||
Saml: &idp_pb.SAMLConfig{
|
Saml: &idp_pb.SAMLConfig{
|
||||||
MetadataXml: template.Metadata,
|
MetadataXml: template.Metadata,
|
||||||
Binding: bindingToPb(template.Binding),
|
Binding: bindingToPb(template.Binding),
|
||||||
WithSignedRequest: template.WithSignedRequest,
|
WithSignedRequest: template.WithSignedRequest,
|
||||||
|
NameIdFormat: nameIDFormat,
|
||||||
|
TransientMappingAttributeName: gu.Ptr(template.TransientMappingAttributeName),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -662,3 +684,18 @@ func bindingToPb(binding string) idp_pb.SAMLBinding {
|
|||||||
return idp_pb.SAMLBinding_SAML_BINDING_UNSPECIFIED
|
return idp_pb.SAMLBinding_SAML_BINDING_UNSPECIFIED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func nameIDToPb(format domain.SAMLNameIDFormat) idp_pb.SAMLNameIDFormat {
|
||||||
|
switch format {
|
||||||
|
case domain.SAMLNameIDFormatUnspecified:
|
||||||
|
return idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_UNSPECIFIED
|
||||||
|
case domain.SAMLNameIDFormatEmailAddress:
|
||||||
|
return idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_EMAIL_ADDRESS
|
||||||
|
case domain.SAMLNameIDFormatPersistent:
|
||||||
|
return idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_PERSISTENT
|
||||||
|
case domain.SAMLNameIDFormatTransient:
|
||||||
|
return idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_TRANSIENT
|
||||||
|
default:
|
||||||
|
return idp_pb.SAMLNameIDFormat_SAML_NAME_ID_FORMAT_UNSPECIFIED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/crewjam/saml"
|
"github.com/crewjam/saml"
|
||||||
|
"github.com/muhlemmer/gu"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/api/authz"
|
"github.com/zitadel/zitadel/internal/api/authz"
|
||||||
idp_grpc "github.com/zitadel/zitadel/internal/api/grpc/idp"
|
idp_grpc "github.com/zitadel/zitadel/internal/api/grpc/idp"
|
||||||
@@ -462,24 +463,36 @@ func updateAppleProviderToCommand(req *mgmt_pb.UpdateAppleProviderRequest) comma
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addSAMLProviderToCommand(req *mgmt_pb.AddSAMLProviderRequest) command.SAMLProvider {
|
func addSAMLProviderToCommand(req *mgmt_pb.AddSAMLProviderRequest) command.SAMLProvider {
|
||||||
|
var nameIDFormat *domain.SAMLNameIDFormat
|
||||||
|
if req.NameIdFormat != nil {
|
||||||
|
nameIDFormat = gu.Ptr(idp_grpc.SAMLNameIDFormatToDomain(req.GetNameIdFormat()))
|
||||||
|
}
|
||||||
return command.SAMLProvider{
|
return command.SAMLProvider{
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
Metadata: req.GetMetadataXml(),
|
Metadata: req.GetMetadataXml(),
|
||||||
MetadataURL: req.GetMetadataUrl(),
|
MetadataURL: req.GetMetadataUrl(),
|
||||||
Binding: bindingToCommand(req.Binding),
|
Binding: bindingToCommand(req.Binding),
|
||||||
WithSignedRequest: req.WithSignedRequest,
|
WithSignedRequest: req.WithSignedRequest,
|
||||||
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
NameIDFormat: nameIDFormat,
|
||||||
|
TransientMappingAttributeName: req.GetTransientMappingAttributeName(),
|
||||||
|
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateSAMLProviderToCommand(req *mgmt_pb.UpdateSAMLProviderRequest) command.SAMLProvider {
|
func updateSAMLProviderToCommand(req *mgmt_pb.UpdateSAMLProviderRequest) command.SAMLProvider {
|
||||||
|
var nameIDFormat *domain.SAMLNameIDFormat
|
||||||
|
if req.NameIdFormat != nil {
|
||||||
|
nameIDFormat = gu.Ptr(idp_grpc.SAMLNameIDFormatToDomain(req.GetNameIdFormat()))
|
||||||
|
}
|
||||||
return command.SAMLProvider{
|
return command.SAMLProvider{
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
Metadata: req.GetMetadataXml(),
|
Metadata: req.GetMetadataXml(),
|
||||||
MetadataURL: req.GetMetadataUrl(),
|
MetadataURL: req.GetMetadataUrl(),
|
||||||
Binding: bindingToCommand(req.Binding),
|
Binding: bindingToCommand(req.Binding),
|
||||||
WithSignedRequest: req.WithSignedRequest,
|
WithSignedRequest: req.WithSignedRequest,
|
||||||
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
NameIDFormat: nameIDFormat,
|
||||||
|
TransientMappingAttributeName: req.GetTransientMappingAttributeName(),
|
||||||
|
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1883,7 +1883,7 @@ func TestServer_StartIdentityProviderIntent(t *testing.T) {
|
|||||||
orgResp := Tester.CreateOrganization(IamCTX, fmt.Sprintf("NotDefaultOrg%d", time.Now().UnixNano()), fmt.Sprintf("%[email protected]", time.Now().UnixNano()))
|
orgResp := Tester.CreateOrganization(IamCTX, fmt.Sprintf("NotDefaultOrg%d", time.Now().UnixNano()), fmt.Sprintf("%[email protected]", time.Now().UnixNano()))
|
||||||
notDefaultOrgIdpID := Tester.AddOrgGenericOAuthProvider(t, CTX, orgResp.OrganizationId)
|
notDefaultOrgIdpID := Tester.AddOrgGenericOAuthProvider(t, CTX, orgResp.OrganizationId)
|
||||||
samlIdpID := Tester.AddSAMLProvider(t, CTX)
|
samlIdpID := Tester.AddSAMLProvider(t, CTX)
|
||||||
samlRedirectIdpID := Tester.AddSAMLRedirectProvider(t, CTX)
|
samlRedirectIdpID := Tester.AddSAMLRedirectProvider(t, CTX, "")
|
||||||
samlPostIdpID := Tester.AddSAMLPostProvider(t, CTX)
|
samlPostIdpID := Tester.AddSAMLPostProvider(t, CTX)
|
||||||
type args struct {
|
type args struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
|||||||
@@ -229,11 +229,6 @@ func (h *Handler) handleACS(w http.ResponseWriter, r *http.Request) {
|
|||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sp, err := samlProvider.GetSP()
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
intent, err := h.commands.GetActiveIntent(ctx, data.RelayState)
|
intent, err := h.commands.GetActiveIntent(ctx, data.RelayState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -245,10 +240,10 @@ func (h *Handler) handleACS(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
session := saml2.Session{
|
session, err := saml2.NewSession(samlProvider, intent.RequestID, r)
|
||||||
ServiceProvider: sp,
|
if err != nil {
|
||||||
RequestID: intent.RequestID,
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
Request: r,
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
idpUser, err := session.FetchUser(r.Context())
|
idpUser, err := session.FetchUser(r.Context())
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestServer_SAMLCertificate(t *testing.T) {
|
func TestServer_SAMLCertificate(t *testing.T) {
|
||||||
samlRedirectIdpID := Tester.AddSAMLRedirectProvider(t, CTX)
|
samlRedirectIdpID := Tester.AddSAMLRedirectProvider(t, CTX, "")
|
||||||
oauthIdpID := Tester.AddGenericOAuthProvider(t, CTX)
|
oauthIdpID := Tester.AddGenericOAuthProvider(t, CTX)
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
@@ -109,7 +109,7 @@ func TestServer_SAMLCertificate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestServer_SAMLMetadata(t *testing.T) {
|
func TestServer_SAMLMetadata(t *testing.T) {
|
||||||
samlRedirectIdpID := Tester.AddSAMLRedirectProvider(t, CTX)
|
samlRedirectIdpID := Tester.AddSAMLRedirectProvider(t, CTX, "")
|
||||||
oauthIdpID := Tester.AddGenericOAuthProvider(t, CTX)
|
oauthIdpID := Tester.AddGenericOAuthProvider(t, CTX)
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
@@ -167,7 +167,7 @@ func TestServer_SAMLMetadata(t *testing.T) {
|
|||||||
|
|
||||||
func TestServer_SAMLACS(t *testing.T) {
|
func TestServer_SAMLACS(t *testing.T) {
|
||||||
userHuman := Tester.CreateHumanUser(CTX)
|
userHuman := Tester.CreateHumanUser(CTX)
|
||||||
samlRedirectIdpID := Tester.AddSAMLRedirectProvider(t, CTX)
|
samlRedirectIdpID := Tester.AddSAMLRedirectProvider(t, CTX, "urn:oid:0.9.2342.19200300.100.1.1") // the username is set in urn:oid:0.9.2342.19200300.100.1.1
|
||||||
externalUserID := "test1"
|
externalUserID := "test1"
|
||||||
linkedExternalUserID := "test2"
|
linkedExternalUserID := "test2"
|
||||||
Tester.CreateUserIDPlink(CTX, userHuman.UserId, linkedExternalUserID, samlRedirectIdpID, linkedExternalUserID)
|
Tester.CreateUserIDPlink(CTX, userHuman.UserId, linkedExternalUserID, samlRedirectIdpID, linkedExternalUserID)
|
||||||
@@ -180,13 +180,15 @@ func TestServer_SAMLACS(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
successURL string
|
successURL string
|
||||||
failureURL string
|
failureURL string
|
||||||
idpID string
|
idpID string
|
||||||
username string
|
username string
|
||||||
intentID string
|
nameID string
|
||||||
response string
|
nameIDFormat string
|
||||||
|
intentID string
|
||||||
|
response string
|
||||||
}
|
}
|
||||||
type want struct {
|
type want struct {
|
||||||
successful bool
|
successful bool
|
||||||
@@ -201,12 +203,14 @@ func TestServer_SAMLACS(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "intent invalid",
|
name: "intent invalid",
|
||||||
args: args{
|
args: args{
|
||||||
ctx: CTX,
|
ctx: CTX,
|
||||||
successURL: "https://example.com/success",
|
successURL: "https://example.com/success",
|
||||||
failureURL: "https://example.com/failure",
|
failureURL: "https://example.com/failure",
|
||||||
idpID: samlRedirectIdpID,
|
idpID: samlRedirectIdpID,
|
||||||
username: externalUserID,
|
username: externalUserID,
|
||||||
intentID: "notexisting",
|
nameID: externalUserID,
|
||||||
|
nameIDFormat: string(saml.PersistentNameIDFormat),
|
||||||
|
intentID: "notexisting",
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
successful: false,
|
successful: false,
|
||||||
@@ -217,12 +221,14 @@ func TestServer_SAMLACS(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "response invalid",
|
name: "response invalid",
|
||||||
args: args{
|
args: args{
|
||||||
ctx: CTX,
|
ctx: CTX,
|
||||||
successURL: "https://example.com/success",
|
successURL: "https://example.com/success",
|
||||||
failureURL: "https://example.com/failure",
|
failureURL: "https://example.com/failure",
|
||||||
idpID: samlRedirectIdpID,
|
idpID: samlRedirectIdpID,
|
||||||
username: externalUserID,
|
username: externalUserID,
|
||||||
response: "invalid",
|
nameID: externalUserID,
|
||||||
|
nameIDFormat: string(saml.PersistentNameIDFormat),
|
||||||
|
response: "invalid",
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
successful: false,
|
successful: false,
|
||||||
@@ -232,11 +238,13 @@ func TestServer_SAMLACS(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "saml flow redirect, ok",
|
name: "saml flow redirect, ok",
|
||||||
args: args{
|
args: args{
|
||||||
ctx: CTX,
|
ctx: CTX,
|
||||||
successURL: "https://example.com/success",
|
successURL: "https://example.com/success",
|
||||||
failureURL: "https://example.com/failure",
|
failureURL: "https://example.com/failure",
|
||||||
idpID: samlRedirectIdpID,
|
idpID: samlRedirectIdpID,
|
||||||
username: externalUserID,
|
username: externalUserID,
|
||||||
|
nameID: externalUserID,
|
||||||
|
nameIDFormat: string(saml.PersistentNameIDFormat),
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
successful: true,
|
successful: true,
|
||||||
@@ -246,11 +254,45 @@ func TestServer_SAMLACS(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "saml flow redirect with link, ok",
|
name: "saml flow redirect with link, ok",
|
||||||
args: args{
|
args: args{
|
||||||
ctx: CTX,
|
ctx: CTX,
|
||||||
successURL: "https://example.com/success",
|
successURL: "https://example.com/success",
|
||||||
failureURL: "https://example.com/failure",
|
failureURL: "https://example.com/failure",
|
||||||
idpID: samlRedirectIdpID,
|
idpID: samlRedirectIdpID,
|
||||||
username: linkedExternalUserID,
|
username: linkedExternalUserID,
|
||||||
|
nameID: linkedExternalUserID,
|
||||||
|
nameIDFormat: string(saml.PersistentNameIDFormat),
|
||||||
|
},
|
||||||
|
want: want{
|
||||||
|
successful: true,
|
||||||
|
user: userHuman.UserId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "saml flow redirect (transient), ok",
|
||||||
|
args: args{
|
||||||
|
ctx: CTX,
|
||||||
|
successURL: "https://example.com/success",
|
||||||
|
failureURL: "https://example.com/failure",
|
||||||
|
idpID: samlRedirectIdpID,
|
||||||
|
username: externalUserID,
|
||||||
|
nameID: "genericID",
|
||||||
|
nameIDFormat: string(saml.TransientNameIDFormat),
|
||||||
|
},
|
||||||
|
want: want{
|
||||||
|
successful: true,
|
||||||
|
user: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "saml flow redirect with link (transient), ok",
|
||||||
|
args: args{
|
||||||
|
ctx: CTX,
|
||||||
|
successURL: "https://example.com/success",
|
||||||
|
failureURL: "https://example.com/failure",
|
||||||
|
idpID: samlRedirectIdpID,
|
||||||
|
username: linkedExternalUserID,
|
||||||
|
nameID: "genericID",
|
||||||
|
nameIDFormat: string(saml.TransientNameIDFormat),
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
successful: true,
|
successful: true,
|
||||||
@@ -287,7 +329,7 @@ func TestServer_SAMLACS(t *testing.T) {
|
|||||||
relayState = tt.args.intentID
|
relayState = tt.args.intentID
|
||||||
}
|
}
|
||||||
callbackURL := http_util.BuildOrigin(Tester.Host(), Tester.Server.Config.ExternalSecure) + "/idps/" + tt.args.idpID + "/saml/acs"
|
callbackURL := http_util.BuildOrigin(Tester.Host(), Tester.Server.Config.ExternalSecure) + "/idps/" + tt.args.idpID + "/saml/acs"
|
||||||
response := createResponse(t, idp, samlRequest, tt.args.username)
|
response := createResponse(t, idp, samlRequest, tt.args.nameID, tt.args.nameIDFormat, tt.args.username)
|
||||||
//test purposes, use defined response
|
//test purposes, use defined response
|
||||||
if tt.args.response != "" {
|
if tt.args.response != "" {
|
||||||
response = tt.args.response
|
response = tt.args.response
|
||||||
@@ -432,14 +474,16 @@ func getIDP(zitadelBaseURL string, idpIDs []string, user1, user2 string) (*saml.
|
|||||||
return &idpServer.IDP, nil
|
return &idpServer.IDP, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func createResponse(t *testing.T, idp *saml.IdentityProvider, req *http.Request, username string) string {
|
func createResponse(t *testing.T, idp *saml.IdentityProvider, req *http.Request, nameID, nameIDFormat, username string) string {
|
||||||
authnReq, err := saml.NewIdpAuthnRequest(idp, req)
|
authnReq, err := saml.NewIdpAuthnRequest(idp, req)
|
||||||
assert.NoError(t, authnReq.Validate())
|
assert.NoError(t, authnReq.Validate())
|
||||||
|
|
||||||
err = idp.AssertionMaker.MakeAssertion(authnReq, &saml.Session{
|
err = idp.AssertionMaker.MakeAssertion(authnReq, &saml.Session{
|
||||||
CreateTime: time.Now().UTC(),
|
CreateTime: time.Now().UTC(),
|
||||||
Index: "",
|
Index: "",
|
||||||
NameID: username,
|
NameID: nameID,
|
||||||
|
NameIDFormat: nameIDFormat,
|
||||||
|
UserName: username,
|
||||||
})
|
})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
err = authnReq.MakeResponse()
|
err = authnReq.MakeResponse()
|
||||||
|
|||||||
@@ -319,12 +319,11 @@ func (l *Login) handleExternalLoginCallback(w http.ResponseWriter, r *http.Reque
|
|||||||
l.externalAuthFailed(w, r, authReq, nil, nil, err)
|
l.externalAuthFailed(w, r, authReq, nil, nil, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sp, err := provider.(*saml.Provider).GetSP()
|
session, err = saml.NewSession(provider.(*saml.Provider), authReq.SAMLRequestID, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.externalAuthFailed(w, r, authReq, nil, nil, err)
|
l.externalAuthFailed(w, r, authReq, nil, nil, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session = &saml.Session{ServiceProvider: sp, RequestID: authReq.SAMLRequestID, Request: r}
|
|
||||||
case domain.IDPTypeJWT,
|
case domain.IDPTypeJWT,
|
||||||
domain.IDPTypeLDAP,
|
domain.IDPTypeLDAP,
|
||||||
domain.IDPTypeUnspecified:
|
domain.IDPTypeUnspecified:
|
||||||
@@ -1029,13 +1028,19 @@ func (l *Login) samlProvider(ctx context.Context, identityProvider *query.IDPTem
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
opts := make([]saml.ProviderOpts, 0, 2)
|
opts := make([]saml.ProviderOpts, 0, 6)
|
||||||
if identityProvider.SAMLIDPTemplate.WithSignedRequest {
|
if identityProvider.SAMLIDPTemplate.WithSignedRequest {
|
||||||
opts = append(opts, saml.WithSignedRequest())
|
opts = append(opts, saml.WithSignedRequest())
|
||||||
}
|
}
|
||||||
if identityProvider.SAMLIDPTemplate.Binding != "" {
|
if identityProvider.SAMLIDPTemplate.Binding != "" {
|
||||||
opts = append(opts, saml.WithBinding(identityProvider.SAMLIDPTemplate.Binding))
|
opts = append(opts, saml.WithBinding(identityProvider.SAMLIDPTemplate.Binding))
|
||||||
}
|
}
|
||||||
|
if identityProvider.SAMLIDPTemplate.NameIDFormat.Valid {
|
||||||
|
opts = append(opts, saml.WithNameIDFormat(identityProvider.SAMLIDPTemplate.NameIDFormat.V))
|
||||||
|
}
|
||||||
|
if identityProvider.SAMLIDPTemplate.TransientMappingAttributeName != "" {
|
||||||
|
opts = append(opts, saml.WithTransientMappingAttributeName(identityProvider.SAMLIDPTemplate.TransientMappingAttributeName))
|
||||||
|
}
|
||||||
opts = append(opts,
|
opts = append(opts,
|
||||||
saml.WithEntityID(http_utils.BuildOrigin(authz.GetInstance(ctx).RequestedHost(), l.externalSecure)+"/idps/"+identityProvider.ID+"/saml/metadata"),
|
saml.WithEntityID(http_utils.BuildOrigin(authz.GetInstance(ctx).RequestedHost(), l.externalSecure)+"/idps/"+identityProvider.ID+"/saml/metadata"),
|
||||||
saml.WithCustomRequestTracker(
|
saml.WithCustomRequestTracker(
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/command/preparation"
|
"github.com/zitadel/zitadel/internal/command/preparation"
|
||||||
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/repository/idp"
|
"github.com/zitadel/zitadel/internal/repository/idp"
|
||||||
"github.com/zitadel/zitadel/internal/zerrors"
|
"github.com/zitadel/zitadel/internal/zerrors"
|
||||||
)
|
)
|
||||||
@@ -110,12 +111,14 @@ type LDAPProvider struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SAMLProvider struct {
|
type SAMLProvider struct {
|
||||||
Name string
|
Name string
|
||||||
Metadata []byte
|
Metadata []byte
|
||||||
MetadataURL string
|
MetadataURL string
|
||||||
Binding string
|
Binding string
|
||||||
WithSignedRequest bool
|
WithSignedRequest bool
|
||||||
IDPOptions idp.Options
|
NameIDFormat *domain.SAMLNameIDFormat
|
||||||
|
TransientMappingAttributeName string
|
||||||
|
IDPOptions idp.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppleProvider struct {
|
type AppleProvider struct {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/crewjam/saml"
|
"github.com/crewjam/saml"
|
||||||
|
"github.com/muhlemmer/gu"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/zitadel/oidc/v3/pkg/oidc"
|
"github.com/zitadel/oidc/v3/pkg/oidc"
|
||||||
@@ -631,6 +632,8 @@ func TestCommands_AuthFromProvider_SAML(t *testing.T) {
|
|||||||
[]byte("certificate"),
|
[]byte("certificate"),
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
gu.Ptr(domain.SAMLNameIDFormatUnspecified),
|
||||||
|
"",
|
||||||
rep_idp.Options{},
|
rep_idp.Options{},
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
@@ -649,6 +652,8 @@ func TestCommands_AuthFromProvider_SAML(t *testing.T) {
|
|||||||
}, []byte("-----BEGIN CERTIFICATE-----\nMIIC2zCCAcOgAwIBAgIIAy/jm1gAAdEwDQYJKoZIhvcNAQELBQAwEjEQMA4GA1UE\nChMHWklUQURFTDAeFw0yMzA4MzAwNzExMTVaFw0yNDA4MjkwNzExMTVaMBIxEDAO\nBgNVBAoTB1pJVEFERUwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDE\nd3TztGgSb3LBVZn8f60NbFCyZW+F9HPiMCr9F9T45Zc0fgmMwxId0WzRD5Y/3yc1\ndHJzt+Bsxvw12aUHbIPiothqk3lINoFzl2H/cSfIW3nehKyNOUqdBQ8B4mvaqH81\njTjoJ/JTJAwzglHk6JAWjhOyx9aep1yBqYa3QASeTaW9sxkpB0Co1L2UPNhuMwZq\n8RA9NkTfmYVcVBeNqihler5MhruFtqrv+J0ftwc1stw8uCN89ADyr4Ni+e+FeWar\nQs9Bkfc6KLF/5IXa9HCsHNPaaoYPY6I6RSaG4/DKoSKIEe1/GSVG1FTpZ8trUZxv\nU+xXS6gEalXcrJsiX8aXAgMBAAGjNTAzMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE\nDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQCx\n/dRNIj0N/16zJhZR/ahkc2AkvDXYxyr4JRT5wK9GQDNl/oaX3debRuSi/tfaXFIX\naJA6PxM4J49ZaiEpLrKfxMz5kAhjKchCBEMcH3mGt+iNZH7EOyTvHjpGrP2OZrsh\nO17yrvN3HuQxIU6roJlqtZz2iAADsoPtwOO4D7hupm9XTMkSnAmlMWOo/q46Jz89\n1sMxB+dXmH/zV0wgwh0omZfLV0u89mvdq269VhcjNBpBYSnN1ccqYWd5iwziob3I\nvaavGHGfkbvRUn/tKftYuTK30q03R+e9YbmlWZ0v695owh2e/apCzowQsCKfSVC8\nOxVyt5XkHq1tWwVyBmFp\n-----END CERTIFICATE-----\n"),
|
}, []byte("-----BEGIN CERTIFICATE-----\nMIIC2zCCAcOgAwIBAgIIAy/jm1gAAdEwDQYJKoZIhvcNAQELBQAwEjEQMA4GA1UE\nChMHWklUQURFTDAeFw0yMzA4MzAwNzExMTVaFw0yNDA4MjkwNzExMTVaMBIxEDAO\nBgNVBAoTB1pJVEFERUwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDE\nd3TztGgSb3LBVZn8f60NbFCyZW+F9HPiMCr9F9T45Zc0fgmMwxId0WzRD5Y/3yc1\ndHJzt+Bsxvw12aUHbIPiothqk3lINoFzl2H/cSfIW3nehKyNOUqdBQ8B4mvaqH81\njTjoJ/JTJAwzglHk6JAWjhOyx9aep1yBqYa3QASeTaW9sxkpB0Co1L2UPNhuMwZq\n8RA9NkTfmYVcVBeNqihler5MhruFtqrv+J0ftwc1stw8uCN89ADyr4Ni+e+FeWar\nQs9Bkfc6KLF/5IXa9HCsHNPaaoYPY6I6RSaG4/DKoSKIEe1/GSVG1FTpZ8trUZxv\nU+xXS6gEalXcrJsiX8aXAgMBAAGjNTAzMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE\nDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQCx\n/dRNIj0N/16zJhZR/ahkc2AkvDXYxyr4JRT5wK9GQDNl/oaX3debRuSi/tfaXFIX\naJA6PxM4J49ZaiEpLrKfxMz5kAhjKchCBEMcH3mGt+iNZH7EOyTvHjpGrP2OZrsh\nO17yrvN3HuQxIU6roJlqtZz2iAADsoPtwOO4D7hupm9XTMkSnAmlMWOo/q46Jz89\n1sMxB+dXmH/zV0wgwh0omZfLV0u89mvdq269VhcjNBpBYSnN1ccqYWd5iwziob3I\nvaavGHGfkbvRUn/tKftYuTK30q03R+e9YbmlWZ0v695owh2e/apCzowQsCKfSVC8\nOxVyt5XkHq1tWwVyBmFp\n-----END CERTIFICATE-----\n"),
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
gu.Ptr(domain.SAMLNameIDFormatUnspecified),
|
||||||
|
"",
|
||||||
rep_idp.Options{},
|
rep_idp.Options{},
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1726,13 +1726,15 @@ func (wm *AppleIDPWriteModel) GetProviderOptions() idp.Options {
|
|||||||
type SAMLIDPWriteModel struct {
|
type SAMLIDPWriteModel struct {
|
||||||
eventstore.WriteModel
|
eventstore.WriteModel
|
||||||
|
|
||||||
Name string
|
Name string
|
||||||
ID string
|
ID string
|
||||||
Metadata []byte
|
Metadata []byte
|
||||||
Key *crypto.CryptoValue
|
Key *crypto.CryptoValue
|
||||||
Certificate []byte
|
Certificate []byte
|
||||||
Binding string
|
Binding string
|
||||||
WithSignedRequest bool
|
WithSignedRequest bool
|
||||||
|
NameIDFormat *domain.SAMLNameIDFormat
|
||||||
|
TransientMappingAttributeName string
|
||||||
idp.Options
|
idp.Options
|
||||||
|
|
||||||
State domain.IDPState
|
State domain.IDPState
|
||||||
@@ -1759,6 +1761,8 @@ func (wm *SAMLIDPWriteModel) reduceAddedEvent(e *idp.SAMLIDPAddedEvent) {
|
|||||||
wm.Certificate = e.Certificate
|
wm.Certificate = e.Certificate
|
||||||
wm.Binding = e.Binding
|
wm.Binding = e.Binding
|
||||||
wm.WithSignedRequest = e.WithSignedRequest
|
wm.WithSignedRequest = e.WithSignedRequest
|
||||||
|
wm.NameIDFormat = e.NameIDFormat
|
||||||
|
wm.TransientMappingAttributeName = e.TransientMappingAttributeName
|
||||||
wm.Options = e.Options
|
wm.Options = e.Options
|
||||||
wm.State = domain.IDPStateActive
|
wm.State = domain.IDPStateActive
|
||||||
}
|
}
|
||||||
@@ -1782,6 +1786,12 @@ func (wm *SAMLIDPWriteModel) reduceChangedEvent(e *idp.SAMLIDPChangedEvent) {
|
|||||||
if e.WithSignedRequest != nil {
|
if e.WithSignedRequest != nil {
|
||||||
wm.WithSignedRequest = *e.WithSignedRequest
|
wm.WithSignedRequest = *e.WithSignedRequest
|
||||||
}
|
}
|
||||||
|
if e.NameIDFormat != nil {
|
||||||
|
wm.NameIDFormat = e.NameIDFormat
|
||||||
|
}
|
||||||
|
if e.TransientMappingAttributeName != nil {
|
||||||
|
wm.TransientMappingAttributeName = *e.TransientMappingAttributeName
|
||||||
|
}
|
||||||
wm.Options.ReduceChanges(e.OptionChanges)
|
wm.Options.ReduceChanges(e.OptionChanges)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1793,6 +1803,8 @@ func (wm *SAMLIDPWriteModel) NewChanges(
|
|||||||
secretCrypto crypto.EncryptionAlgorithm,
|
secretCrypto crypto.EncryptionAlgorithm,
|
||||||
binding string,
|
binding string,
|
||||||
withSignedRequest bool,
|
withSignedRequest bool,
|
||||||
|
nameIDFormat *domain.SAMLNameIDFormat,
|
||||||
|
transientMappingAttributeName string,
|
||||||
options idp.Options,
|
options idp.Options,
|
||||||
) ([]idp.SAMLIDPChanges, error) {
|
) ([]idp.SAMLIDPChanges, error) {
|
||||||
changes := make([]idp.SAMLIDPChanges, 0)
|
changes := make([]idp.SAMLIDPChanges, 0)
|
||||||
@@ -1818,6 +1830,12 @@ func (wm *SAMLIDPWriteModel) NewChanges(
|
|||||||
if wm.WithSignedRequest != withSignedRequest {
|
if wm.WithSignedRequest != withSignedRequest {
|
||||||
changes = append(changes, idp.ChangeSAMLWithSignedRequest(withSignedRequest))
|
changes = append(changes, idp.ChangeSAMLWithSignedRequest(withSignedRequest))
|
||||||
}
|
}
|
||||||
|
if wm.NameIDFormat != nameIDFormat {
|
||||||
|
changes = append(changes, idp.ChangeSAMLNameIDFormat(nameIDFormat))
|
||||||
|
}
|
||||||
|
if wm.TransientMappingAttributeName != transientMappingAttributeName {
|
||||||
|
changes = append(changes, idp.ChangeSAMLTransientMappingAttributeName(transientMappingAttributeName))
|
||||||
|
}
|
||||||
opts := wm.Options.Changes(options)
|
opts := wm.Options.Changes(options)
|
||||||
if !opts.IsZero() {
|
if !opts.IsZero() {
|
||||||
changes = append(changes, idp.ChangeSAMLOptions(opts))
|
changes = append(changes, idp.ChangeSAMLOptions(opts))
|
||||||
@@ -1850,6 +1868,12 @@ func (wm *SAMLIDPWriteModel) ToProvider(callbackURL string, idpAlg crypto.Encryp
|
|||||||
if wm.Binding != "" {
|
if wm.Binding != "" {
|
||||||
opts = append(opts, saml2.WithBinding(wm.Binding))
|
opts = append(opts, saml2.WithBinding(wm.Binding))
|
||||||
}
|
}
|
||||||
|
if wm.NameIDFormat != nil {
|
||||||
|
opts = append(opts, saml2.WithNameIDFormat(*wm.NameIDFormat))
|
||||||
|
}
|
||||||
|
if wm.TransientMappingAttributeName != "" {
|
||||||
|
opts = append(opts, saml2.WithTransientMappingAttributeName(wm.TransientMappingAttributeName))
|
||||||
|
}
|
||||||
opts = append(opts, saml2.WithCustomRequestTracker(
|
opts = append(opts, saml2.WithCustomRequestTracker(
|
||||||
requesttracker.New(
|
requesttracker.New(
|
||||||
addRequest,
|
addRequest,
|
||||||
|
|||||||
@@ -1763,6 +1763,8 @@ func (c *Commands) prepareAddInstanceSAMLProvider(a *instance.Aggregate, writeMo
|
|||||||
cert,
|
cert,
|
||||||
provider.Binding,
|
provider.Binding,
|
||||||
provider.WithSignedRequest,
|
provider.WithSignedRequest,
|
||||||
|
provider.NameIDFormat,
|
||||||
|
provider.TransientMappingAttributeName,
|
||||||
provider.IDPOptions,
|
provider.IDPOptions,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
@@ -1811,6 +1813,8 @@ func (c *Commands) prepareUpdateInstanceSAMLProvider(a *instance.Aggregate, writ
|
|||||||
c.idpConfigEncryption,
|
c.idpConfigEncryption,
|
||||||
provider.Binding,
|
provider.Binding,
|
||||||
provider.WithSignedRequest,
|
provider.WithSignedRequest,
|
||||||
|
provider.NameIDFormat,
|
||||||
|
provider.TransientMappingAttributeName,
|
||||||
provider.IDPOptions,
|
provider.IDPOptions,
|
||||||
)
|
)
|
||||||
if err != nil || event == nil {
|
if err != nil || event == nil {
|
||||||
@@ -1854,6 +1858,8 @@ func (c *Commands) prepareRegenerateInstanceSAMLProviderCertificate(a *instance.
|
|||||||
c.idpConfigEncryption,
|
c.idpConfigEncryption,
|
||||||
writeModel.Binding,
|
writeModel.Binding,
|
||||||
writeModel.WithSignedRequest,
|
writeModel.WithSignedRequest,
|
||||||
|
writeModel.NameIDFormat,
|
||||||
|
writeModel.TransientMappingAttributeName,
|
||||||
writeModel.Options,
|
writeModel.Options,
|
||||||
)
|
)
|
||||||
if err != nil || event == nil {
|
if err != nil || event == nil {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/crypto"
|
"github.com/zitadel/zitadel/internal/crypto"
|
||||||
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/eventstore"
|
"github.com/zitadel/zitadel/internal/eventstore"
|
||||||
"github.com/zitadel/zitadel/internal/repository/idp"
|
"github.com/zitadel/zitadel/internal/repository/idp"
|
||||||
"github.com/zitadel/zitadel/internal/repository/instance"
|
"github.com/zitadel/zitadel/internal/repository/instance"
|
||||||
@@ -915,6 +916,8 @@ func (wm *InstanceSAMLIDPWriteModel) NewChangedEvent(
|
|||||||
secretCrypto crypto.EncryptionAlgorithm,
|
secretCrypto crypto.EncryptionAlgorithm,
|
||||||
binding string,
|
binding string,
|
||||||
withSignedRequest bool,
|
withSignedRequest bool,
|
||||||
|
nameIDFormat *domain.SAMLNameIDFormat,
|
||||||
|
transientMappingAttributeName string,
|
||||||
options idp.Options,
|
options idp.Options,
|
||||||
) (*instance.SAMLIDPChangedEvent, error) {
|
) (*instance.SAMLIDPChangedEvent, error) {
|
||||||
changes, err := wm.SAMLIDPWriteModel.NewChanges(
|
changes, err := wm.SAMLIDPWriteModel.NewChanges(
|
||||||
@@ -925,6 +928,8 @@ func (wm *InstanceSAMLIDPWriteModel) NewChangedEvent(
|
|||||||
secretCrypto,
|
secretCrypto,
|
||||||
binding,
|
binding,
|
||||||
withSignedRequest,
|
withSignedRequest,
|
||||||
|
nameIDFormat,
|
||||||
|
transientMappingAttributeName,
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
if err != nil || len(changes) == 0 {
|
if err != nil || len(changes) == 0 {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1746,6 +1746,8 @@ func (c *Commands) prepareAddOrgSAMLProvider(a *org.Aggregate, writeModel *OrgSA
|
|||||||
cert,
|
cert,
|
||||||
provider.Binding,
|
provider.Binding,
|
||||||
provider.WithSignedRequest,
|
provider.WithSignedRequest,
|
||||||
|
provider.NameIDFormat,
|
||||||
|
provider.TransientMappingAttributeName,
|
||||||
provider.IDPOptions,
|
provider.IDPOptions,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
@@ -1794,6 +1796,8 @@ func (c *Commands) prepareUpdateOrgSAMLProvider(a *org.Aggregate, writeModel *Or
|
|||||||
c.idpConfigEncryption,
|
c.idpConfigEncryption,
|
||||||
provider.Binding,
|
provider.Binding,
|
||||||
provider.WithSignedRequest,
|
provider.WithSignedRequest,
|
||||||
|
provider.NameIDFormat,
|
||||||
|
provider.TransientMappingAttributeName,
|
||||||
provider.IDPOptions,
|
provider.IDPOptions,
|
||||||
)
|
)
|
||||||
if err != nil || event == nil {
|
if err != nil || event == nil {
|
||||||
@@ -1837,6 +1841,8 @@ func (c *Commands) prepareRegenerateOrgSAMLProviderCertificate(a *org.Aggregate,
|
|||||||
c.idpConfigEncryption,
|
c.idpConfigEncryption,
|
||||||
writeModel.Binding,
|
writeModel.Binding,
|
||||||
writeModel.WithSignedRequest,
|
writeModel.WithSignedRequest,
|
||||||
|
writeModel.NameIDFormat,
|
||||||
|
writeModel.TransientMappingAttributeName,
|
||||||
writeModel.Options,
|
writeModel.Options,
|
||||||
)
|
)
|
||||||
if err != nil || event == nil {
|
if err != nil || event == nil {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/crypto"
|
"github.com/zitadel/zitadel/internal/crypto"
|
||||||
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/eventstore"
|
"github.com/zitadel/zitadel/internal/eventstore"
|
||||||
"github.com/zitadel/zitadel/internal/repository/idp"
|
"github.com/zitadel/zitadel/internal/repository/idp"
|
||||||
"github.com/zitadel/zitadel/internal/repository/org"
|
"github.com/zitadel/zitadel/internal/repository/org"
|
||||||
@@ -927,6 +928,8 @@ func (wm *OrgSAMLIDPWriteModel) NewChangedEvent(
|
|||||||
secretCrypto crypto.EncryptionAlgorithm,
|
secretCrypto crypto.EncryptionAlgorithm,
|
||||||
binding string,
|
binding string,
|
||||||
withSignedRequest bool,
|
withSignedRequest bool,
|
||||||
|
nameIDFormat *domain.SAMLNameIDFormat,
|
||||||
|
transientMappingAttributeName string,
|
||||||
options idp.Options,
|
options idp.Options,
|
||||||
) (*org.SAMLIDPChangedEvent, error) {
|
) (*org.SAMLIDPChangedEvent, error) {
|
||||||
changes, err := wm.SAMLIDPWriteModel.NewChanges(
|
changes, err := wm.SAMLIDPWriteModel.NewChanges(
|
||||||
@@ -937,6 +940,8 @@ func (wm *OrgSAMLIDPWriteModel) NewChangedEvent(
|
|||||||
secretCrypto,
|
secretCrypto,
|
||||||
binding,
|
binding,
|
||||||
withSignedRequest,
|
withSignedRequest,
|
||||||
|
nameIDFormat,
|
||||||
|
transientMappingAttributeName,
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
if err != nil || len(changes) == 0 {
|
if err != nil || len(changes) == 0 {
|
||||||
|
|||||||
+233
-216
File diff suppressed because it is too large
Load Diff
@@ -134,3 +134,12 @@ const (
|
|||||||
AutoLinkingOptionUsername
|
AutoLinkingOptionUsername
|
||||||
AutoLinkingOptionEmail
|
AutoLinkingOptionEmail
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type SAMLNameIDFormat uint8
|
||||||
|
|
||||||
|
const (
|
||||||
|
SAMLNameIDFormatUnspecified SAMLNameIDFormat = iota
|
||||||
|
SAMLNameIDFormatEmailAddress
|
||||||
|
SAMLNameIDFormatPersistent
|
||||||
|
SAMLNameIDFormatTransient
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package saml
|
package saml
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/crewjam/saml"
|
|
||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/domain"
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
@@ -20,8 +19,8 @@ func NewUser() *UserMapper {
|
|||||||
return &UserMapper{Attributes: map[string][]string{}}
|
return &UserMapper{Attributes: map[string][]string{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserMapper) SetID(id *saml.NameID) {
|
func (u *UserMapper) SetID(id string) {
|
||||||
u.ID = id.Value
|
u.ID = id
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetID is an implementation of the [idp.User] interface.
|
// GetID is an implementation of the [idp.User] interface.
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/crewjam/saml"
|
"github.com/crewjam/saml"
|
||||||
"github.com/crewjam/saml/samlsp"
|
"github.com/crewjam/saml/samlsp"
|
||||||
|
|
||||||
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/idp"
|
"github.com/zitadel/zitadel/internal/idp"
|
||||||
"github.com/zitadel/zitadel/internal/zerrors"
|
"github.com/zitadel/zitadel/internal/zerrors"
|
||||||
)
|
)
|
||||||
@@ -26,7 +27,9 @@ type Provider struct {
|
|||||||
|
|
||||||
spOptions *samlsp.Options
|
spOptions *samlsp.Options
|
||||||
|
|
||||||
binding string
|
binding string
|
||||||
|
nameIDFormat saml.NameIDFormat
|
||||||
|
transientMappingAttributeName string
|
||||||
|
|
||||||
isLinkingAllowed bool
|
isLinkingAllowed bool
|
||||||
isCreationAllowed bool
|
isCreationAllowed bool
|
||||||
@@ -77,6 +80,18 @@ func WithBinding(binding string) ProviderOpts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithNameIDFormat(format domain.SAMLNameIDFormat) ProviderOpts {
|
||||||
|
return func(p *Provider) {
|
||||||
|
p.nameIDFormat = nameIDFormatFromDomain(format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTransientMappingAttributeName(attribute string) ProviderOpts {
|
||||||
|
return func(p *Provider) {
|
||||||
|
p.transientMappingAttributeName = attribute
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func WithCustomRequestTracker(tracker samlsp.RequestTracker) ProviderOpts {
|
func WithCustomRequestTracker(tracker samlsp.RequestTracker) ProviderOpts {
|
||||||
return func(p *Provider) {
|
return func(p *Provider) {
|
||||||
p.requestTracker = tracker
|
p.requestTracker = tracker
|
||||||
@@ -124,6 +139,8 @@ func New(
|
|||||||
name: name,
|
name: name,
|
||||||
spOptions: &opts,
|
spOptions: &opts,
|
||||||
Certificate: certificate,
|
Certificate: certificate,
|
||||||
|
// the library uses transient as default, which does not make sense for federating accounts
|
||||||
|
nameIDFormat: saml.PersistentNameIDFormat,
|
||||||
}
|
}
|
||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
option(provider)
|
option(provider)
|
||||||
@@ -156,10 +173,7 @@ func (p *Provider) GetSP() (*samlsp.Middleware, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, zerrors.ThrowInternal(err, "SAML-qee09ffuq5", "Errors.Intent.IDPInvalid")
|
return nil, zerrors.ThrowInternal(err, "SAML-qee09ffuq5", "Errors.Intent.IDPInvalid")
|
||||||
}
|
}
|
||||||
// the library uses transient as default, which we currently can't handle (https://github.com/zitadel/zitadel/discussions/7421)
|
sp.ServiceProvider.AuthnNameIDFormat = p.nameIDFormat
|
||||||
// for the moment we'll use persistent (for those who actually use it from the saml request) and add an option
|
|
||||||
// later on to specify on the provider: https://github.com/zitadel/zitadel/issues/7743
|
|
||||||
sp.ServiceProvider.AuthnNameIDFormat = saml.PersistentNameIDFormat
|
|
||||||
if p.requestTracker != nil {
|
if p.requestTracker != nil {
|
||||||
sp.RequestTracker = p.requestTracker
|
sp.RequestTracker = p.requestTracker
|
||||||
}
|
}
|
||||||
@@ -180,3 +194,22 @@ func (p *Provider) BeginAuth(ctx context.Context, state string, _ ...idp.Paramet
|
|||||||
state: state,
|
state: state,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Provider) TransientMappingAttributeName() string {
|
||||||
|
return p.transientMappingAttributeName
|
||||||
|
}
|
||||||
|
|
||||||
|
func nameIDFormatFromDomain(format domain.SAMLNameIDFormat) saml.NameIDFormat {
|
||||||
|
switch format {
|
||||||
|
case domain.SAMLNameIDFormatUnspecified:
|
||||||
|
return saml.UnspecifiedNameIDFormat
|
||||||
|
case domain.SAMLNameIDFormatEmailAddress:
|
||||||
|
return saml.EmailAddressNameIDFormat
|
||||||
|
case domain.SAMLNameIDFormatPersistent:
|
||||||
|
return saml.PersistentNameIDFormat
|
||||||
|
case domain.SAMLNameIDFormatTransient:
|
||||||
|
return saml.TransientNameIDFormat
|
||||||
|
default:
|
||||||
|
return saml.UnspecifiedNameIDFormat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ package saml
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/crewjam/saml"
|
||||||
"github.com/crewjam/saml/samlsp"
|
"github.com/crewjam/saml/samlsp"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/idp/providers/saml/requesttracker"
|
"github.com/zitadel/zitadel/internal/idp/providers/saml/requesttracker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,16 +22,18 @@ func TestProvider_Options(t *testing.T) {
|
|||||||
options []ProviderOpts
|
options []ProviderOpts
|
||||||
}
|
}
|
||||||
type want struct {
|
type want struct {
|
||||||
err bool
|
err bool
|
||||||
name string
|
name string
|
||||||
linkingAllowed bool
|
linkingAllowed bool
|
||||||
creationAllowed bool
|
creationAllowed bool
|
||||||
autoCreation bool
|
autoCreation bool
|
||||||
autoUpdate bool
|
autoUpdate bool
|
||||||
binding string
|
binding string
|
||||||
withSignedRequest bool
|
nameIDFormat saml.NameIDFormat
|
||||||
requesttracker samlsp.RequestTracker
|
transientMappingAttributeName string
|
||||||
entityID string
|
withSignedRequest bool
|
||||||
|
requesttracker samlsp.RequestTracker
|
||||||
|
entityID string
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -103,10 +107,11 @@ func TestProvider_Options(t *testing.T) {
|
|||||||
creationAllowed: false,
|
creationAllowed: false,
|
||||||
autoCreation: false,
|
autoCreation: false,
|
||||||
autoUpdate: false,
|
autoUpdate: false,
|
||||||
|
nameIDFormat: saml.PersistentNameIDFormat,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "all true",
|
name: "all set / true",
|
||||||
fields: fields{
|
fields: fields{
|
||||||
name: "saml",
|
name: "saml",
|
||||||
key: []byte("-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAxHd087RoEm9ywVWZ/H+tDWxQsmVvhfRz4jAq/RfU+OWXNH4J\njMMSHdFs0Q+WP98nNXRyc7fgbMb8NdmlB2yD4qLYapN5SDaBc5dh/3EnyFt53oSs\njTlKnQUPAeJr2qh/NY046CfyUyQMM4JR5OiQFo4TssfWnqdcgamGt0AEnk2lvbMZ\nKQdAqNS9lDzYbjMGavEQPTZE35mFXFQXjaooZXq+TIa7hbaq7/idH7cHNbLcPLgj\nfPQA8q+DYvnvhXlmq0LPQZH3Oiixf+SF2vRwrBzT2mqGD2OiOkUmhuPwyqEiiBHt\nfxklRtRU6WfLa1Gcb1PsV0uoBGpV3KybIl/GlwIDAQABAoIBAEQjDduLgOCL6Gem\n0X3hpdnW6/HC/jed/Sa//9jBECq2LYeWAqff64ON40hqOHi0YvvGA/+gEOSI6mWe\nsv5tIxxRz+6+cLybsq+tG96kluCE4TJMHy/nY7orS/YiWbd+4odnEApr+D3fbZ/b\nnZ1fDsHTyn8hkYx6jLmnWsJpIHDp7zxD76y7k2Bbg6DZrCGiVxngiLJk23dvz79W\np03lHLM7XE92aFwXQmhfxHGxrbuoB/9eY4ai5IHp36H4fw0vL6NXdNQAo/bhe0p9\nAYB7y0ZumF8Hg0Z/BmMeEzLy6HrYB+VE8cO93pNjhSyH+p2yDB/BlUyTiRLQAoM0\nVTmOZXECgYEA7NGlzpKNhyQEJihVqt0MW0LhKIO/xbBn+XgYfX6GpqPa/ucnMx5/\nVezpl3gK8IU4wPUhAyXXAHJiqNBcEeyxrw0MXLujDVMJgYaLysCLJdvMVgoY08mS\nK5IQivpbozpf4+0y3mOnA+Sy1kbfxv2X8xiWLODRQW3f3q/xoklwOR8CgYEA1GEe\nfaibOFTQAYcIVj77KXtBfYZsX3EGAyfAN9O7cKHq5oaxVstwnF47WxpuVtoKZxCZ\nbNm9D5WvQ9b+Ztpioe42tzwE7Bff/Osj868GcDdRPK7nFlh9N2yVn/D514dOYVwR\n4MBr1KrJzgRWt4QqS4H+to1GzudDTSNlG7gnK4kCgYBUi6AbOHzoYzZL/RhgcJwp\ntJ23nhmH1Su5h2OO4e3mbhcP66w19sxU+8iFN+kH5zfUw26utgKk+TE5vXExQQRK\nT2k7bg2PAzcgk80ybD0BHhA8I0yrx4m0nmfjhe/TPVLgh10iwgbtP+eM0i6v1vc5\nZWyvxu9N4ZEL6lpkqr0y1wKBgG/NAIQd8jhhTW7Aav8cAJQBsqQl038avJOEpYe+\nCnpsgoAAf/K0/f8TDCQVceh+t+MxtdK7fO9rWOxZjWsPo8Si5mLnUaAHoX4/OpnZ\nlYYVWMqdOEFnK+O1Yb7k2GFBdV2DXlX2dc1qavntBsls5ecB89id3pyk2aUN8Pf6\npYQhAoGAMGtrHFely9wyaxI0RTCyfmJbWZHGVGkv6ELK8wneJjdjl82XOBUGCg5q\naRCrTZ3dPitKwrUa6ibJCIFCIziiriBmjDvTHzkMvoJEap2TVxYNDR6IfINVsQ57\nlOsiC4A2uGq4Lbfld+gjoplJ5GX6qXtTgZ6m7eo0y7U6zm2tkN0=\n-----END RSA PRIVATE KEY-----\n"),
|
key: []byte("-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAxHd087RoEm9ywVWZ/H+tDWxQsmVvhfRz4jAq/RfU+OWXNH4J\njMMSHdFs0Q+WP98nNXRyc7fgbMb8NdmlB2yD4qLYapN5SDaBc5dh/3EnyFt53oSs\njTlKnQUPAeJr2qh/NY046CfyUyQMM4JR5OiQFo4TssfWnqdcgamGt0AEnk2lvbMZ\nKQdAqNS9lDzYbjMGavEQPTZE35mFXFQXjaooZXq+TIa7hbaq7/idH7cHNbLcPLgj\nfPQA8q+DYvnvhXlmq0LPQZH3Oiixf+SF2vRwrBzT2mqGD2OiOkUmhuPwyqEiiBHt\nfxklRtRU6WfLa1Gcb1PsV0uoBGpV3KybIl/GlwIDAQABAoIBAEQjDduLgOCL6Gem\n0X3hpdnW6/HC/jed/Sa//9jBECq2LYeWAqff64ON40hqOHi0YvvGA/+gEOSI6mWe\nsv5tIxxRz+6+cLybsq+tG96kluCE4TJMHy/nY7orS/YiWbd+4odnEApr+D3fbZ/b\nnZ1fDsHTyn8hkYx6jLmnWsJpIHDp7zxD76y7k2Bbg6DZrCGiVxngiLJk23dvz79W\np03lHLM7XE92aFwXQmhfxHGxrbuoB/9eY4ai5IHp36H4fw0vL6NXdNQAo/bhe0p9\nAYB7y0ZumF8Hg0Z/BmMeEzLy6HrYB+VE8cO93pNjhSyH+p2yDB/BlUyTiRLQAoM0\nVTmOZXECgYEA7NGlzpKNhyQEJihVqt0MW0LhKIO/xbBn+XgYfX6GpqPa/ucnMx5/\nVezpl3gK8IU4wPUhAyXXAHJiqNBcEeyxrw0MXLujDVMJgYaLysCLJdvMVgoY08mS\nK5IQivpbozpf4+0y3mOnA+Sy1kbfxv2X8xiWLODRQW3f3q/xoklwOR8CgYEA1GEe\nfaibOFTQAYcIVj77KXtBfYZsX3EGAyfAN9O7cKHq5oaxVstwnF47WxpuVtoKZxCZ\nbNm9D5WvQ9b+Ztpioe42tzwE7Bff/Osj868GcDdRPK7nFlh9N2yVn/D514dOYVwR\n4MBr1KrJzgRWt4QqS4H+to1GzudDTSNlG7gnK4kCgYBUi6AbOHzoYzZL/RhgcJwp\ntJ23nhmH1Su5h2OO4e3mbhcP66w19sxU+8iFN+kH5zfUw26utgKk+TE5vXExQQRK\nT2k7bg2PAzcgk80ybD0BHhA8I0yrx4m0nmfjhe/TPVLgh10iwgbtP+eM0i6v1vc5\nZWyvxu9N4ZEL6lpkqr0y1wKBgG/NAIQd8jhhTW7Aav8cAJQBsqQl038avJOEpYe+\nCnpsgoAAf/K0/f8TDCQVceh+t+MxtdK7fO9rWOxZjWsPo8Si5mLnUaAHoX4/OpnZ\nlYYVWMqdOEFnK+O1Yb7k2GFBdV2DXlX2dc1qavntBsls5ecB89id3pyk2aUN8Pf6\npYQhAoGAMGtrHFely9wyaxI0RTCyfmJbWZHGVGkv6ELK8wneJjdjl82XOBUGCg5q\naRCrTZ3dPitKwrUa6ibJCIFCIziiriBmjDvTHzkMvoJEap2TVxYNDR6IfINVsQ57\nlOsiC4A2uGq4Lbfld+gjoplJ5GX6qXtTgZ6m7eo0y7U6zm2tkN0=\n-----END RSA PRIVATE KEY-----\n"),
|
||||||
@@ -121,18 +126,22 @@ func TestProvider_Options(t *testing.T) {
|
|||||||
WithSignedRequest(),
|
WithSignedRequest(),
|
||||||
WithCustomRequestTracker(&requesttracker.RequestTracker{}),
|
WithCustomRequestTracker(&requesttracker.RequestTracker{}),
|
||||||
WithEntityID("entityID"),
|
WithEntityID("entityID"),
|
||||||
|
WithNameIDFormat(domain.SAMLNameIDFormatTransient),
|
||||||
|
WithTransientMappingAttributeName("attribute"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
name: "saml",
|
name: "saml",
|
||||||
linkingAllowed: true,
|
linkingAllowed: true,
|
||||||
creationAllowed: true,
|
creationAllowed: true,
|
||||||
autoCreation: true,
|
autoCreation: true,
|
||||||
autoUpdate: true,
|
autoUpdate: true,
|
||||||
binding: "binding",
|
binding: "binding",
|
||||||
withSignedRequest: true,
|
entityID: "entityID",
|
||||||
requesttracker: &requesttracker.RequestTracker{},
|
nameIDFormat: saml.TransientNameIDFormat,
|
||||||
entityID: "entityID",
|
transientMappingAttributeName: "attribute",
|
||||||
|
withSignedRequest: true,
|
||||||
|
requesttracker: &requesttracker.RequestTracker{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -152,6 +161,8 @@ func TestProvider_Options(t *testing.T) {
|
|||||||
a.Equal(tt.want.autoCreation, provider.IsAutoCreation())
|
a.Equal(tt.want.autoCreation, provider.IsAutoCreation())
|
||||||
a.Equal(tt.want.autoUpdate, provider.IsAutoUpdate())
|
a.Equal(tt.want.autoUpdate, provider.IsAutoUpdate())
|
||||||
a.Equal(tt.want.binding, provider.binding)
|
a.Equal(tt.want.binding, provider.binding)
|
||||||
|
a.Equal(tt.want.nameIDFormat, provider.nameIDFormat)
|
||||||
|
a.Equal(tt.want.transientMappingAttributeName, provider.transientMappingAttributeName)
|
||||||
a.Equal(tt.want.withSignedRequest, provider.spOptions.SignRequest)
|
a.Equal(tt.want.withSignedRequest, provider.spOptions.SignRequest)
|
||||||
a.Equal(tt.want.requesttracker, provider.requestTracker)
|
a.Equal(tt.want.requesttracker, provider.requestTracker)
|
||||||
a.Equal(tt.want.entityID, provider.spOptions.EntityID)
|
a.Equal(tt.want.entityID, provider.spOptions.EntityID)
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ var _ idp.Session = (*Session)(nil)
|
|||||||
|
|
||||||
// Session is the [idp.Session] implementation for the SAML provider.
|
// Session is the [idp.Session] implementation for the SAML provider.
|
||||||
type Session struct {
|
type Session struct {
|
||||||
ServiceProvider *samlsp.Middleware
|
ServiceProvider *samlsp.Middleware
|
||||||
state string
|
state string
|
||||||
|
TransientMappingAttributeName string
|
||||||
|
|
||||||
RequestID string
|
RequestID string
|
||||||
Request *http.Request
|
Request *http.Request
|
||||||
@@ -26,6 +27,19 @@ type Session struct {
|
|||||||
Assertion *saml.Assertion
|
Assertion *saml.Assertion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewSession(provider *Provider, requestID string, request *http.Request) (*Session, error) {
|
||||||
|
sp, err := provider.GetSP()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &Session{
|
||||||
|
ServiceProvider: sp,
|
||||||
|
TransientMappingAttributeName: provider.TransientMappingAttributeName(),
|
||||||
|
RequestID: requestID,
|
||||||
|
Request: request,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetAuth implements the [idp.Session] interface.
|
// GetAuth implements the [idp.Session] interface.
|
||||||
func (s *Session) GetAuth(ctx context.Context) (string, bool) {
|
func (s *Session) GetAuth(ctx context.Context) (string, bool) {
|
||||||
url, _ := url.Parse(s.state)
|
url, _ := url.Parse(s.state)
|
||||||
@@ -56,8 +70,17 @@ func (s *Session) FetchUser(ctx context.Context) (user idp.User, err error) {
|
|||||||
return nil, zerrors.ThrowInvalidArgument(err, "SAML-nuo0vphhh9", "Errors.Intent.ResponseInvalid")
|
return nil, zerrors.ThrowInvalidArgument(err, "SAML-nuo0vphhh9", "Errors.Intent.ResponseInvalid")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nameID := s.Assertion.Subject.NameID
|
||||||
userMapper := NewUser()
|
userMapper := NewUser()
|
||||||
userMapper.SetID(s.Assertion.Subject.NameID)
|
// use the nameID as default mapping id
|
||||||
|
userMapper.SetID(nameID.Value)
|
||||||
|
if nameID.Format == string(saml.TransientNameIDFormat) {
|
||||||
|
mappingID, err := s.transientMappingID()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
userMapper.SetID(mappingID)
|
||||||
|
}
|
||||||
for _, statement := range s.Assertion.AttributeStatements {
|
for _, statement := range s.Assertion.AttributeStatements {
|
||||||
for _, attribute := range statement.Attributes {
|
for _, attribute := range statement.Attributes {
|
||||||
values := make([]string, len(attribute.Values))
|
values := make([]string, len(attribute.Values))
|
||||||
@@ -70,6 +93,21 @@ func (s *Session) FetchUser(ctx context.Context) (user idp.User, err error) {
|
|||||||
return userMapper, nil
|
return userMapper, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Session) transientMappingID() (string, error) {
|
||||||
|
for _, statement := range s.Assertion.AttributeStatements {
|
||||||
|
for _, attribute := range statement.Attributes {
|
||||||
|
if attribute.Name != s.TransientMappingAttributeName {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(attribute.Values) != 1 {
|
||||||
|
return "", zerrors.ThrowInvalidArgument(nil, "SAML-Soij4", "Errors.Intent.MissingSingleMappingAttribute")
|
||||||
|
}
|
||||||
|
return attribute.Values[0].Value, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "", zerrors.ThrowInvalidArgument(nil, "SAML-swwg2", "Errors.Intent.MissingSingleMappingAttribute")
|
||||||
|
}
|
||||||
|
|
||||||
type TempResponseWriter struct {
|
type TempResponseWriter struct {
|
||||||
header http.Header
|
header http.Header
|
||||||
content *bytes.Buffer
|
content *bytes.Buffer
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -380,12 +380,13 @@ func (s *Tester) AddSAMLProvider(t *testing.T, ctx context.Context) string {
|
|||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Tester) AddSAMLRedirectProvider(t *testing.T, ctx context.Context) string {
|
func (s *Tester) AddSAMLRedirectProvider(t *testing.T, ctx context.Context, transientMappingAttributeName string) string {
|
||||||
ctx = authz.WithInstance(ctx, s.Instance)
|
ctx = authz.WithInstance(ctx, s.Instance)
|
||||||
id, _, err := s.Server.Commands.AddInstanceSAMLProvider(ctx, command.SAMLProvider{
|
id, _, err := s.Server.Commands.AddInstanceSAMLProvider(ctx, command.SAMLProvider{
|
||||||
Name: "saml-idp-redirect",
|
Name: "saml-idp-redirect",
|
||||||
Binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect",
|
Binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect",
|
||||||
Metadata: []byte("<EntityDescriptor xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\" validUntil=\"2023-09-16T09:00:32.986Z\" cacheDuration=\"PT48H\" entityID=\"http://localhost:8000/metadata\">\n <IDPSSODescriptor xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\">\n <KeyDescriptor use=\"signing\">\n <KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n <X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n <X509Certificate xmlns=\"http://www.w3.org/2000/09/xmldsig#\">MIIDBzCCAe+gAwIBAgIJAPr/Mrlc8EGhMA0GCSqGSIb3DQEBBQUAMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTAeFw0xNTEyMjgxOTE5NDVaFw0yNTEyMjUxOTE5NDVaMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANDoWzLos4LWxTn8Gyu2lEbl4WcelUbgLN5zYm4ron8Ahs+rvcsu2zkdD/s6jdGJI8WqJKhYK2u61ygnXgAZqC6ggtFPnBpizcDzjgND2g+aucSoUODHt67f0fQuAmupN/zp5MZysJ6IHLJnYLNpfJYk96lRz9ODnO1Mpqtr9PWxm+pz7nzq5F0vRepkgpcRxv6ufQBjlrFytccyEVdXrvFtkjXcnhVVNSR4kHuOOMS6D7pebSJ1mrCmshbD5SX1jXPBKFPAjozYX6PxqLxUx1Y4faFEf4MBBVcInyB4oURNB2s59hEEi2jq9izNE7EbEK6BY5sEhoCPl9m32zE6ljkCAwEAAaNQME4wHQYDVR0OBBYEFB9ZklC1Ork2zl56zg08ei7ss/+iMB8GA1UdIwQYMBaAFB9ZklC1Ork2zl56zg08ei7ss/+iMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAVoTSQ5pAirw8OR9FZ1bRSuTDhY9uxzl/OL7lUmsv2cMNeCB3BRZqm3mFt+cwN8GsH6f3uvNONIhgFpTGN5LEcXQz89zJEzB+qaHqmbFpHQl/sx2B8ezNgT/882H2IH00dXESEfy/+1gHg2pxjGnhRBN6el/gSaDiySIMKbilDrffuvxiCfbpPN0NRRiPJhd2ay9KuL/RxQRl1gl9cHaWiouWWba1bSBb2ZPhv2rPMUsFo98ntkGCObDX6Y1SpkqmoTbrsbGFsTG2DLxnvr4GdN1BSr0Uu/KV3adj47WkXVPeMYQti/bQmxQB8tRFhrw80qakTLUzreO96WzlBBMtY=</X509Certificate>\n </X509Data>\n </KeyInfo>\n </KeyDescriptor>\n <KeyDescriptor use=\"encryption\">\n <KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n <X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n <X509Certificate xmlns=\"http://www.w3.org/2000/09/xmldsig#\">MIIDBzCCAe+gAwIBAgIJAPr/Mrlc8EGhMA0GCSqGSIb3DQEBBQUAMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTAeFw0xNTEyMjgxOTE5NDVaFw0yNTEyMjUxOTE5NDVaMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANDoWzLos4LWxTn8Gyu2lEbl4WcelUbgLN5zYm4ron8Ahs+rvcsu2zkdD/s6jdGJI8WqJKhYK2u61ygnXgAZqC6ggtFPnBpizcDzjgND2g+aucSoUODHt67f0fQuAmupN/zp5MZysJ6IHLJnYLNpfJYk96lRz9ODnO1Mpqtr9PWxm+pz7nzq5F0vRepkgpcRxv6ufQBjlrFytccyEVdXrvFtkjXcnhVVNSR4kHuOOMS6D7pebSJ1mrCmshbD5SX1jXPBKFPAjozYX6PxqLxUx1Y4faFEf4MBBVcInyB4oURNB2s59hEEi2jq9izNE7EbEK6BY5sEhoCPl9m32zE6ljkCAwEAAaNQME4wHQYDVR0OBBYEFB9ZklC1Ork2zl56zg08ei7ss/+iMB8GA1UdIwQYMBaAFB9ZklC1Ork2zl56zg08ei7ss/+iMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAVoTSQ5pAirw8OR9FZ1bRSuTDhY9uxzl/OL7lUmsv2cMNeCB3BRZqm3mFt+cwN8GsH6f3uvNONIhgFpTGN5LEcXQz89zJEzB+qaHqmbFpHQl/sx2B8ezNgT/882H2IH00dXESEfy/+1gHg2pxjGnhRBN6el/gSaDiySIMKbilDrffuvxiCfbpPN0NRRiPJhd2ay9KuL/RxQRl1gl9cHaWiouWWba1bSBb2ZPhv2rPMUsFo98ntkGCObDX6Y1SpkqmoTbrsbGFsTG2DLxnvr4GdN1BSr0Uu/KV3adj47WkXVPeMYQti/bQmxQB8tRFhrw80qakTLUzreO96WzlBBMtY=</X509Certificate>\n </X509Data>\n </KeyInfo>\n <EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#aes128-cbc\"></EncryptionMethod>\n <EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#aes192-cbc\"></EncryptionMethod>\n <EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#aes256-cbc\"></EncryptionMethod>\n <EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p\"></EncryptionMethod>\n </KeyDescriptor>\n <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>\n <SingleSignOnService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\" Location=\"http://localhost:8000/sso\"></SingleSignOnService>\n </IDPSSODescriptor>\n</EntityDescriptor>"),
|
Metadata: []byte("<EntityDescriptor xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\" validUntil=\"2023-09-16T09:00:32.986Z\" cacheDuration=\"PT48H\" entityID=\"http://localhost:8000/metadata\">\n <IDPSSODescriptor xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\">\n <KeyDescriptor use=\"signing\">\n <KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n <X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n <X509Certificate xmlns=\"http://www.w3.org/2000/09/xmldsig#\">MIIDBzCCAe+gAwIBAgIJAPr/Mrlc8EGhMA0GCSqGSIb3DQEBBQUAMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTAeFw0xNTEyMjgxOTE5NDVaFw0yNTEyMjUxOTE5NDVaMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANDoWzLos4LWxTn8Gyu2lEbl4WcelUbgLN5zYm4ron8Ahs+rvcsu2zkdD/s6jdGJI8WqJKhYK2u61ygnXgAZqC6ggtFPnBpizcDzjgND2g+aucSoUODHt67f0fQuAmupN/zp5MZysJ6IHLJnYLNpfJYk96lRz9ODnO1Mpqtr9PWxm+pz7nzq5F0vRepkgpcRxv6ufQBjlrFytccyEVdXrvFtkjXcnhVVNSR4kHuOOMS6D7pebSJ1mrCmshbD5SX1jXPBKFPAjozYX6PxqLxUx1Y4faFEf4MBBVcInyB4oURNB2s59hEEi2jq9izNE7EbEK6BY5sEhoCPl9m32zE6ljkCAwEAAaNQME4wHQYDVR0OBBYEFB9ZklC1Ork2zl56zg08ei7ss/+iMB8GA1UdIwQYMBaAFB9ZklC1Ork2zl56zg08ei7ss/+iMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAVoTSQ5pAirw8OR9FZ1bRSuTDhY9uxzl/OL7lUmsv2cMNeCB3BRZqm3mFt+cwN8GsH6f3uvNONIhgFpTGN5LEcXQz89zJEzB+qaHqmbFpHQl/sx2B8ezNgT/882H2IH00dXESEfy/+1gHg2pxjGnhRBN6el/gSaDiySIMKbilDrffuvxiCfbpPN0NRRiPJhd2ay9KuL/RxQRl1gl9cHaWiouWWba1bSBb2ZPhv2rPMUsFo98ntkGCObDX6Y1SpkqmoTbrsbGFsTG2DLxnvr4GdN1BSr0Uu/KV3adj47WkXVPeMYQti/bQmxQB8tRFhrw80qakTLUzreO96WzlBBMtY=</X509Certificate>\n </X509Data>\n </KeyInfo>\n </KeyDescriptor>\n <KeyDescriptor use=\"encryption\">\n <KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n <X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\">\n <X509Certificate xmlns=\"http://www.w3.org/2000/09/xmldsig#\">MIIDBzCCAe+gAwIBAgIJAPr/Mrlc8EGhMA0GCSqGSIb3DQEBBQUAMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTAeFw0xNTEyMjgxOTE5NDVaFw0yNTEyMjUxOTE5NDVaMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANDoWzLos4LWxTn8Gyu2lEbl4WcelUbgLN5zYm4ron8Ahs+rvcsu2zkdD/s6jdGJI8WqJKhYK2u61ygnXgAZqC6ggtFPnBpizcDzjgND2g+aucSoUODHt67f0fQuAmupN/zp5MZysJ6IHLJnYLNpfJYk96lRz9ODnO1Mpqtr9PWxm+pz7nzq5F0vRepkgpcRxv6ufQBjlrFytccyEVdXrvFtkjXcnhVVNSR4kHuOOMS6D7pebSJ1mrCmshbD5SX1jXPBKFPAjozYX6PxqLxUx1Y4faFEf4MBBVcInyB4oURNB2s59hEEi2jq9izNE7EbEK6BY5sEhoCPl9m32zE6ljkCAwEAAaNQME4wHQYDVR0OBBYEFB9ZklC1Ork2zl56zg08ei7ss/+iMB8GA1UdIwQYMBaAFB9ZklC1Ork2zl56zg08ei7ss/+iMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAVoTSQ5pAirw8OR9FZ1bRSuTDhY9uxzl/OL7lUmsv2cMNeCB3BRZqm3mFt+cwN8GsH6f3uvNONIhgFpTGN5LEcXQz89zJEzB+qaHqmbFpHQl/sx2B8ezNgT/882H2IH00dXESEfy/+1gHg2pxjGnhRBN6el/gSaDiySIMKbilDrffuvxiCfbpPN0NRRiPJhd2ay9KuL/RxQRl1gl9cHaWiouWWba1bSBb2ZPhv2rPMUsFo98ntkGCObDX6Y1SpkqmoTbrsbGFsTG2DLxnvr4GdN1BSr0Uu/KV3adj47WkXVPeMYQti/bQmxQB8tRFhrw80qakTLUzreO96WzlBBMtY=</X509Certificate>\n </X509Data>\n </KeyInfo>\n <EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#aes128-cbc\"></EncryptionMethod>\n <EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#aes192-cbc\"></EncryptionMethod>\n <EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#aes256-cbc\"></EncryptionMethod>\n <EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p\"></EncryptionMethod>\n </KeyDescriptor>\n <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>\n <SingleSignOnService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\" Location=\"http://localhost:8000/sso\"></SingleSignOnService>\n </IDPSSODescriptor>\n</EntityDescriptor>"),
|
||||||
|
TransientMappingAttributeName: transientMappingAttributeName,
|
||||||
IDPOptions: idp.Options{
|
IDPOptions: idp.Options{
|
||||||
IsLinkingAllowed: true,
|
IsLinkingAllowed: true,
|
||||||
IsCreationAllowed: true,
|
IsCreationAllowed: true,
|
||||||
|
|||||||
@@ -155,12 +155,14 @@ type AppleIDPTemplate struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SAMLIDPTemplate struct {
|
type SAMLIDPTemplate struct {
|
||||||
IDPID string
|
IDPID string
|
||||||
Metadata []byte
|
Metadata []byte
|
||||||
Key *crypto.CryptoValue
|
Key *crypto.CryptoValue
|
||||||
Certificate []byte
|
Certificate []byte
|
||||||
Binding string
|
Binding string
|
||||||
WithSignedRequest bool
|
WithSignedRequest bool
|
||||||
|
NameIDFormat sql.Null[domain.SAMLNameIDFormat]
|
||||||
|
TransientMappingAttributeName string
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -700,6 +702,14 @@ var (
|
|||||||
name: projection.SAMLWithSignedRequestCol,
|
name: projection.SAMLWithSignedRequestCol,
|
||||||
table: samlIdpTemplateTable,
|
table: samlIdpTemplateTable,
|
||||||
}
|
}
|
||||||
|
SAMLNameIDFormatCol = Column{
|
||||||
|
name: projection.SAMLNameIDFormatCol,
|
||||||
|
table: samlIdpTemplateTable,
|
||||||
|
}
|
||||||
|
SAMLTransientMappingAttributeNameCol = Column{
|
||||||
|
name: projection.SAMLTransientMappingAttributeName,
|
||||||
|
table: samlIdpTemplateTable,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// IDPTemplateByID searches for the requested id
|
// IDPTemplateByID searches for the requested id
|
||||||
@@ -883,6 +893,8 @@ func prepareIDPTemplateByIDQuery(ctx context.Context, db prepareDatabase) (sq.Se
|
|||||||
SAMLCertificateCol.identifier(),
|
SAMLCertificateCol.identifier(),
|
||||||
SAMLBindingCol.identifier(),
|
SAMLBindingCol.identifier(),
|
||||||
SAMLWithSignedRequestCol.identifier(),
|
SAMLWithSignedRequestCol.identifier(),
|
||||||
|
SAMLNameIDFormatCol.identifier(),
|
||||||
|
SAMLTransientMappingAttributeNameCol.identifier(),
|
||||||
// ldap
|
// ldap
|
||||||
LDAPIDCol.identifier(),
|
LDAPIDCol.identifier(),
|
||||||
LDAPServersCol.identifier(),
|
LDAPServersCol.identifier(),
|
||||||
@@ -997,6 +1009,8 @@ func prepareIDPTemplateByIDQuery(ctx context.Context, db prepareDatabase) (sq.Se
|
|||||||
var samlCertificate []byte
|
var samlCertificate []byte
|
||||||
samlBinding := sql.NullString{}
|
samlBinding := sql.NullString{}
|
||||||
samlWithSignedRequest := sql.NullBool{}
|
samlWithSignedRequest := sql.NullBool{}
|
||||||
|
samlNameIDFormat := sql.Null[domain.SAMLNameIDFormat]{}
|
||||||
|
samlTransientMappingAttributeName := sql.NullString{}
|
||||||
|
|
||||||
ldapID := sql.NullString{}
|
ldapID := sql.NullString{}
|
||||||
ldapServers := database.TextArray[string]{}
|
ldapServers := database.TextArray[string]{}
|
||||||
@@ -1109,6 +1123,8 @@ func prepareIDPTemplateByIDQuery(ctx context.Context, db prepareDatabase) (sq.Se
|
|||||||
&samlCertificate,
|
&samlCertificate,
|
||||||
&samlBinding,
|
&samlBinding,
|
||||||
&samlWithSignedRequest,
|
&samlWithSignedRequest,
|
||||||
|
&samlNameIDFormat,
|
||||||
|
&samlTransientMappingAttributeName,
|
||||||
// ldap
|
// ldap
|
||||||
&ldapID,
|
&ldapID,
|
||||||
&ldapServers,
|
&ldapServers,
|
||||||
@@ -1237,12 +1253,14 @@ func prepareIDPTemplateByIDQuery(ctx context.Context, db prepareDatabase) (sq.Se
|
|||||||
}
|
}
|
||||||
if samlID.Valid {
|
if samlID.Valid {
|
||||||
idpTemplate.SAMLIDPTemplate = &SAMLIDPTemplate{
|
idpTemplate.SAMLIDPTemplate = &SAMLIDPTemplate{
|
||||||
IDPID: samlID.String,
|
IDPID: samlID.String,
|
||||||
Metadata: samlMetadata,
|
Metadata: samlMetadata,
|
||||||
Key: samlKey,
|
Key: samlKey,
|
||||||
Certificate: samlCertificate,
|
Certificate: samlCertificate,
|
||||||
Binding: samlBinding.String,
|
Binding: samlBinding.String,
|
||||||
WithSignedRequest: samlWithSignedRequest.Bool,
|
WithSignedRequest: samlWithSignedRequest.Bool,
|
||||||
|
NameIDFormat: samlNameIDFormat,
|
||||||
|
TransientMappingAttributeName: samlTransientMappingAttributeName.String,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ldapID.Valid {
|
if ldapID.Valid {
|
||||||
@@ -1370,6 +1388,8 @@ func prepareIDPTemplatesQuery(ctx context.Context, db prepareDatabase) (sq.Selec
|
|||||||
SAMLCertificateCol.identifier(),
|
SAMLCertificateCol.identifier(),
|
||||||
SAMLBindingCol.identifier(),
|
SAMLBindingCol.identifier(),
|
||||||
SAMLWithSignedRequestCol.identifier(),
|
SAMLWithSignedRequestCol.identifier(),
|
||||||
|
SAMLNameIDFormatCol.identifier(),
|
||||||
|
SAMLTransientMappingAttributeNameCol.identifier(),
|
||||||
// ldap
|
// ldap
|
||||||
LDAPIDCol.identifier(),
|
LDAPIDCol.identifier(),
|
||||||
LDAPServersCol.identifier(),
|
LDAPServersCol.identifier(),
|
||||||
@@ -1489,6 +1509,8 @@ func prepareIDPTemplatesQuery(ctx context.Context, db prepareDatabase) (sq.Selec
|
|||||||
var samlCertificate []byte
|
var samlCertificate []byte
|
||||||
samlBinding := sql.NullString{}
|
samlBinding := sql.NullString{}
|
||||||
samlWithSignedRequest := sql.NullBool{}
|
samlWithSignedRequest := sql.NullBool{}
|
||||||
|
samlNameIDFormat := sql.Null[domain.SAMLNameIDFormat]{}
|
||||||
|
samlTransientMappingAttributeName := sql.NullString{}
|
||||||
|
|
||||||
ldapID := sql.NullString{}
|
ldapID := sql.NullString{}
|
||||||
ldapServers := database.TextArray[string]{}
|
ldapServers := database.TextArray[string]{}
|
||||||
@@ -1601,6 +1623,8 @@ func prepareIDPTemplatesQuery(ctx context.Context, db prepareDatabase) (sq.Selec
|
|||||||
&samlCertificate,
|
&samlCertificate,
|
||||||
&samlBinding,
|
&samlBinding,
|
||||||
&samlWithSignedRequest,
|
&samlWithSignedRequest,
|
||||||
|
&samlNameIDFormat,
|
||||||
|
&samlTransientMappingAttributeName,
|
||||||
// ldap
|
// ldap
|
||||||
&ldapID,
|
&ldapID,
|
||||||
&ldapServers,
|
&ldapServers,
|
||||||
@@ -1728,12 +1752,14 @@ func prepareIDPTemplatesQuery(ctx context.Context, db prepareDatabase) (sq.Selec
|
|||||||
}
|
}
|
||||||
if samlID.Valid {
|
if samlID.Valid {
|
||||||
idpTemplate.SAMLIDPTemplate = &SAMLIDPTemplate{
|
idpTemplate.SAMLIDPTemplate = &SAMLIDPTemplate{
|
||||||
IDPID: samlID.String,
|
IDPID: samlID.String,
|
||||||
Metadata: samlMetadata,
|
Metadata: samlMetadata,
|
||||||
Key: samlKey,
|
Key: samlKey,
|
||||||
Certificate: samlCertificate,
|
Certificate: samlCertificate,
|
||||||
Binding: samlBinding.String,
|
Binding: samlBinding.String,
|
||||||
WithSignedRequest: samlWithSignedRequest.Bool,
|
WithSignedRequest: samlWithSignedRequest.Bool,
|
||||||
|
NameIDFormat: samlNameIDFormat,
|
||||||
|
TransientMappingAttributeName: samlTransientMappingAttributeName.String,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ldapID.Valid {
|
if ldapID.Valid {
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ var (
|
|||||||
` projections.idp_templates6_saml.certificate,` +
|
` projections.idp_templates6_saml.certificate,` +
|
||||||
` projections.idp_templates6_saml.binding,` +
|
` projections.idp_templates6_saml.binding,` +
|
||||||
` projections.idp_templates6_saml.with_signed_request,` +
|
` projections.idp_templates6_saml.with_signed_request,` +
|
||||||
|
` projections.idp_templates6_saml.name_id_format,` +
|
||||||
|
` projections.idp_templates6_saml.transient_mapping_attribute_name,` +
|
||||||
// ldap
|
// ldap
|
||||||
` projections.idp_templates6_ldap2.idp_id,` +
|
` projections.idp_templates6_ldap2.idp_id,` +
|
||||||
` projections.idp_templates6_ldap2.servers,` +
|
` projections.idp_templates6_ldap2.servers,` +
|
||||||
@@ -220,6 +222,8 @@ var (
|
|||||||
"certificate",
|
"certificate",
|
||||||
"binding",
|
"binding",
|
||||||
"with_signed_request",
|
"with_signed_request",
|
||||||
|
"name_id_format",
|
||||||
|
"transient_mapping_attribute_name",
|
||||||
// ldap config
|
// ldap config
|
||||||
"idp_id",
|
"idp_id",
|
||||||
"servers",
|
"servers",
|
||||||
@@ -331,6 +335,8 @@ var (
|
|||||||
` projections.idp_templates6_saml.certificate,` +
|
` projections.idp_templates6_saml.certificate,` +
|
||||||
` projections.idp_templates6_saml.binding,` +
|
` projections.idp_templates6_saml.binding,` +
|
||||||
` projections.idp_templates6_saml.with_signed_request,` +
|
` projections.idp_templates6_saml.with_signed_request,` +
|
||||||
|
` projections.idp_templates6_saml.name_id_format,` +
|
||||||
|
` projections.idp_templates6_saml.transient_mapping_attribute_name,` +
|
||||||
// ldap
|
// ldap
|
||||||
` projections.idp_templates6_ldap2.idp_id,` +
|
` projections.idp_templates6_ldap2.idp_id,` +
|
||||||
` projections.idp_templates6_ldap2.servers,` +
|
` projections.idp_templates6_ldap2.servers,` +
|
||||||
@@ -457,6 +463,8 @@ var (
|
|||||||
"certificate",
|
"certificate",
|
||||||
"binding",
|
"binding",
|
||||||
"with_signed_request",
|
"with_signed_request",
|
||||||
|
"name_id_format",
|
||||||
|
"transient_mapping_attribute_name",
|
||||||
// ldap config
|
// ldap config
|
||||||
"idp_id",
|
"idp_id",
|
||||||
"servers",
|
"servers",
|
||||||
@@ -608,6 +616,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -756,6 +766,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -902,6 +914,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -1047,6 +1061,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -1191,6 +1207,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -1335,6 +1353,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -1480,6 +1500,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -1624,6 +1646,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
"binding",
|
"binding",
|
||||||
false,
|
false,
|
||||||
|
domain.SAMLNameIDFormatTransient,
|
||||||
|
"customAttribute",
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -1674,12 +1698,14 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
IsAutoUpdate: true,
|
IsAutoUpdate: true,
|
||||||
AutoLinking: domain.AutoLinkingOptionUsername,
|
AutoLinking: domain.AutoLinkingOptionUsername,
|
||||||
SAMLIDPTemplate: &SAMLIDPTemplate{
|
SAMLIDPTemplate: &SAMLIDPTemplate{
|
||||||
IDPID: "idp-id",
|
IDPID: "idp-id",
|
||||||
Metadata: []byte("metadata"),
|
Metadata: []byte("metadata"),
|
||||||
Key: nil,
|
Key: nil,
|
||||||
Certificate: nil,
|
Certificate: nil,
|
||||||
Binding: "binding",
|
Binding: "binding",
|
||||||
WithSignedRequest: false,
|
WithSignedRequest: false,
|
||||||
|
NameIDFormat: sql.Null[domain.SAMLNameIDFormat]{V: domain.SAMLNameIDFormatTransient, Valid: true},
|
||||||
|
TransientMappingAttributeName: "customAttribute",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1770,6 +1796,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
"idp-id",
|
"idp-id",
|
||||||
database.TextArray[string]{"server"},
|
database.TextArray[string]{"server"},
|
||||||
@@ -1934,6 +1962,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -2080,6 +2110,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -2254,6 +2286,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
"idp-id",
|
"idp-id",
|
||||||
database.TextArray[string]{"server"},
|
database.TextArray[string]{"server"},
|
||||||
@@ -2427,6 +2461,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -2574,6 +2610,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
"idp-id-ldap",
|
"idp-id-ldap",
|
||||||
database.TextArray[string]{"server"},
|
database.TextArray[string]{"server"},
|
||||||
@@ -2686,6 +2724,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
"binding",
|
"binding",
|
||||||
false,
|
false,
|
||||||
|
domain.SAMLNameIDFormatTransient,
|
||||||
|
"customAttribute",
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -2798,6 +2838,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -2910,6 +2952,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -3022,6 +3066,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -3134,6 +3180,8 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
// ldap config
|
// ldap config
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@@ -3232,12 +3280,14 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
|||||||
IsAutoUpdate: true,
|
IsAutoUpdate: true,
|
||||||
AutoLinking: domain.AutoLinkingOptionUsername,
|
AutoLinking: domain.AutoLinkingOptionUsername,
|
||||||
SAMLIDPTemplate: &SAMLIDPTemplate{
|
SAMLIDPTemplate: &SAMLIDPTemplate{
|
||||||
IDPID: "idp-id-saml",
|
IDPID: "idp-id-saml",
|
||||||
Metadata: []byte("metadata"),
|
Metadata: []byte("metadata"),
|
||||||
Key: nil,
|
Key: nil,
|
||||||
Certificate: nil,
|
Certificate: nil,
|
||||||
Binding: "binding",
|
Binding: "binding",
|
||||||
WithSignedRequest: false,
|
WithSignedRequest: false,
|
||||||
|
NameIDFormat: sql.Null[domain.SAMLNameIDFormat]{V: domain.SAMLNameIDFormatTransient, Valid: true},
|
||||||
|
TransientMappingAttributeName: "customAttribute",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -161,13 +161,15 @@ const (
|
|||||||
ApplePrivateKeyCol = "private_key"
|
ApplePrivateKeyCol = "private_key"
|
||||||
AppleScopesCol = "scopes"
|
AppleScopesCol = "scopes"
|
||||||
|
|
||||||
SAMLIDCol = "idp_id"
|
SAMLIDCol = "idp_id"
|
||||||
SAMLInstanceIDCol = "instance_id"
|
SAMLInstanceIDCol = "instance_id"
|
||||||
SAMLMetadataCol = "metadata"
|
SAMLMetadataCol = "metadata"
|
||||||
SAMLKeyCol = "key"
|
SAMLKeyCol = "key"
|
||||||
SAMLCertificateCol = "certificate"
|
SAMLCertificateCol = "certificate"
|
||||||
SAMLBindingCol = "binding"
|
SAMLBindingCol = "binding"
|
||||||
SAMLWithSignedRequestCol = "with_signed_request"
|
SAMLWithSignedRequestCol = "with_signed_request"
|
||||||
|
SAMLNameIDFormatCol = "name_id_format"
|
||||||
|
SAMLTransientMappingAttributeName = "transient_mapping_attribute_name"
|
||||||
)
|
)
|
||||||
|
|
||||||
type idpTemplateProjection struct{}
|
type idpTemplateProjection struct{}
|
||||||
@@ -367,6 +369,8 @@ func (*idpTemplateProjection) Init() *old_handler.Check {
|
|||||||
handler.NewColumn(SAMLCertificateCol, handler.ColumnTypeBytes),
|
handler.NewColumn(SAMLCertificateCol, handler.ColumnTypeBytes),
|
||||||
handler.NewColumn(SAMLBindingCol, handler.ColumnTypeText, handler.Nullable()),
|
handler.NewColumn(SAMLBindingCol, handler.ColumnTypeText, handler.Nullable()),
|
||||||
handler.NewColumn(SAMLWithSignedRequestCol, handler.ColumnTypeBool, handler.Nullable()),
|
handler.NewColumn(SAMLWithSignedRequestCol, handler.ColumnTypeBool, handler.Nullable()),
|
||||||
|
handler.NewColumn(SAMLNameIDFormatCol, handler.ColumnTypeEnum, handler.Nullable()),
|
||||||
|
handler.NewColumn(SAMLTransientMappingAttributeName, handler.ColumnTypeText, handler.Nullable()),
|
||||||
},
|
},
|
||||||
handler.NewPrimaryKey(SAMLInstanceIDCol, SAMLIDCol),
|
handler.NewPrimaryKey(SAMLInstanceIDCol, SAMLIDCol),
|
||||||
IDPTemplateSAMLSuffix,
|
IDPTemplateSAMLSuffix,
|
||||||
@@ -1967,6 +1971,20 @@ func (p *idpTemplateProjection) reduceSAMLIDPAdded(event eventstore.Event) (*han
|
|||||||
return nil, zerrors.ThrowInvalidArgumentf(nil, "HANDL-9s02m1", "reduce.wrong.event.type %v", []eventstore.EventType{org.SAMLIDPAddedEventType, instance.SAMLIDPAddedEventType})
|
return nil, zerrors.ThrowInvalidArgumentf(nil, "HANDL-9s02m1", "reduce.wrong.event.type %v", []eventstore.EventType{org.SAMLIDPAddedEventType, instance.SAMLIDPAddedEventType})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
columns := []handler.Column{
|
||||||
|
handler.NewCol(SAMLIDCol, idpEvent.ID),
|
||||||
|
handler.NewCol(SAMLInstanceIDCol, idpEvent.Aggregate().InstanceID),
|
||||||
|
handler.NewCol(SAMLMetadataCol, idpEvent.Metadata),
|
||||||
|
handler.NewCol(SAMLKeyCol, idpEvent.Key),
|
||||||
|
handler.NewCol(SAMLCertificateCol, idpEvent.Certificate),
|
||||||
|
handler.NewCol(SAMLBindingCol, idpEvent.Binding),
|
||||||
|
handler.NewCol(SAMLWithSignedRequestCol, idpEvent.WithSignedRequest),
|
||||||
|
handler.NewCol(SAMLTransientMappingAttributeName, idpEvent.TransientMappingAttributeName),
|
||||||
|
}
|
||||||
|
if idpEvent.NameIDFormat != nil {
|
||||||
|
columns = append(columns, handler.NewCol(SAMLNameIDFormatCol, *idpEvent.NameIDFormat))
|
||||||
|
}
|
||||||
|
|
||||||
return handler.NewMultiStatement(
|
return handler.NewMultiStatement(
|
||||||
&idpEvent,
|
&idpEvent,
|
||||||
handler.AddCreateStatement(
|
handler.AddCreateStatement(
|
||||||
@@ -1989,15 +2007,7 @@ func (p *idpTemplateProjection) reduceSAMLIDPAdded(event eventstore.Event) (*han
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
handler.AddCreateStatement(
|
handler.AddCreateStatement(
|
||||||
[]handler.Column{
|
columns,
|
||||||
handler.NewCol(SAMLIDCol, idpEvent.ID),
|
|
||||||
handler.NewCol(SAMLInstanceIDCol, idpEvent.Aggregate().InstanceID),
|
|
||||||
handler.NewCol(SAMLMetadataCol, idpEvent.Metadata),
|
|
||||||
handler.NewCol(SAMLKeyCol, idpEvent.Key),
|
|
||||||
handler.NewCol(SAMLCertificateCol, idpEvent.Certificate),
|
|
||||||
handler.NewCol(SAMLBindingCol, idpEvent.Binding),
|
|
||||||
handler.NewCol(SAMLWithSignedRequestCol, idpEvent.WithSignedRequest),
|
|
||||||
},
|
|
||||||
handler.WithTableSuffix(IDPTemplateSAMLSuffix),
|
handler.WithTableSuffix(IDPTemplateSAMLSuffix),
|
||||||
),
|
),
|
||||||
), nil
|
), nil
|
||||||
@@ -2490,5 +2500,11 @@ func reduceSAMLIDPChangedColumns(idpEvent idp.SAMLIDPChangedEvent) []handler.Col
|
|||||||
if idpEvent.WithSignedRequest != nil {
|
if idpEvent.WithSignedRequest != nil {
|
||||||
SAMLCols = append(SAMLCols, handler.NewCol(SAMLWithSignedRequestCol, *idpEvent.WithSignedRequest))
|
SAMLCols = append(SAMLCols, handler.NewCol(SAMLWithSignedRequestCol, *idpEvent.WithSignedRequest))
|
||||||
}
|
}
|
||||||
|
if idpEvent.NameIDFormat != nil {
|
||||||
|
SAMLCols = append(SAMLCols, handler.NewCol(SAMLNameIDFormatCol, *idpEvent.NameIDFormat))
|
||||||
|
}
|
||||||
|
if idpEvent.TransientMappingAttributeName != nil {
|
||||||
|
SAMLCols = append(SAMLCols, handler.NewCol(SAMLTransientMappingAttributeName, *idpEvent.TransientMappingAttributeName))
|
||||||
|
}
|
||||||
return SAMLCols
|
return SAMLCols
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2774,6 +2774,8 @@ func TestIDPTemplateProjection_reducesSAML(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"certificate": `+stringToJSONByte("certificate")+`,
|
"certificate": `+stringToJSONByte("certificate")+`,
|
||||||
"binding": "binding",
|
"binding": "binding",
|
||||||
|
"nameIDFormat": 3,
|
||||||
|
"transientMappingAttributeName": "customAttribute",
|
||||||
"withSignedRequest": true,
|
"withSignedRequest": true,
|
||||||
"isCreationAllowed": true,
|
"isCreationAllowed": true,
|
||||||
"isLinkingAllowed": true,
|
"isLinkingAllowed": true,
|
||||||
@@ -2810,7 +2812,7 @@ func TestIDPTemplateProjection_reducesSAML(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.idp_templates6_saml (idp_id, instance_id, metadata, key, certificate, binding, with_signed_request) VALUES ($1, $2, $3, $4, $5, $6, $7)",
|
expectedStmt: "INSERT INTO projections.idp_templates6_saml (idp_id, instance_id, metadata, key, certificate, binding, with_signed_request, transient_mapping_attribute_name, name_id_format) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"idp-id",
|
"idp-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@@ -2819,6 +2821,8 @@ func TestIDPTemplateProjection_reducesSAML(t *testing.T) {
|
|||||||
anyArg{},
|
anyArg{},
|
||||||
"binding",
|
"binding",
|
||||||
true,
|
true,
|
||||||
|
"customAttribute",
|
||||||
|
domain.SAMLNameIDFormatTransient,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -2842,6 +2846,8 @@ func TestIDPTemplateProjection_reducesSAML(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"certificate": `+stringToJSONByte("certificate")+`,
|
"certificate": `+stringToJSONByte("certificate")+`,
|
||||||
"binding": "binding",
|
"binding": "binding",
|
||||||
|
"nameIDFormat": 3,
|
||||||
|
"transientMappingAttributeName": "customAttribute",
|
||||||
"withSignedRequest": true,
|
"withSignedRequest": true,
|
||||||
"isCreationAllowed": true,
|
"isCreationAllowed": true,
|
||||||
"isLinkingAllowed": true,
|
"isLinkingAllowed": true,
|
||||||
@@ -2878,7 +2884,7 @@ func TestIDPTemplateProjection_reducesSAML(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.idp_templates6_saml (idp_id, instance_id, metadata, key, certificate, binding, with_signed_request) VALUES ($1, $2, $3, $4, $5, $6, $7)",
|
expectedStmt: "INSERT INTO projections.idp_templates6_saml (idp_id, instance_id, metadata, key, certificate, binding, with_signed_request, transient_mapping_attribute_name, name_id_format) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"idp-id",
|
"idp-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@@ -2887,6 +2893,8 @@ func TestIDPTemplateProjection_reducesSAML(t *testing.T) {
|
|||||||
anyArg{},
|
anyArg{},
|
||||||
"binding",
|
"binding",
|
||||||
true,
|
true,
|
||||||
|
"customAttribute",
|
||||||
|
domain.SAMLNameIDFormatTransient,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package idp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zitadel/zitadel/internal/crypto"
|
"github.com/zitadel/zitadel/internal/crypto"
|
||||||
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/eventstore"
|
"github.com/zitadel/zitadel/internal/eventstore"
|
||||||
"github.com/zitadel/zitadel/internal/zerrors"
|
"github.com/zitadel/zitadel/internal/zerrors"
|
||||||
)
|
)
|
||||||
@@ -9,13 +10,15 @@ import (
|
|||||||
type SAMLIDPAddedEvent struct {
|
type SAMLIDPAddedEvent struct {
|
||||||
eventstore.BaseEvent `json:"-"`
|
eventstore.BaseEvent `json:"-"`
|
||||||
|
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Metadata []byte `json:"metadata,omitempty"`
|
Metadata []byte `json:"metadata,omitempty"`
|
||||||
Key *crypto.CryptoValue `json:"key,omitempty"`
|
Key *crypto.CryptoValue `json:"key,omitempty"`
|
||||||
Certificate []byte `json:"certificate,omitempty"`
|
Certificate []byte `json:"certificate,omitempty"`
|
||||||
Binding string `json:"binding,omitempty"`
|
Binding string `json:"binding,omitempty"`
|
||||||
WithSignedRequest bool `json:"withSignedRequest,omitempty"`
|
WithSignedRequest bool `json:"withSignedRequest,omitempty"`
|
||||||
|
NameIDFormat *domain.SAMLNameIDFormat `json:"nameIDFormat,omitempty"`
|
||||||
|
TransientMappingAttributeName string `json:"transientMappingAttributeName,omitempty"`
|
||||||
Options
|
Options
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,18 +31,22 @@ func NewSAMLIDPAddedEvent(
|
|||||||
certificate []byte,
|
certificate []byte,
|
||||||
binding string,
|
binding string,
|
||||||
withSignedRequest bool,
|
withSignedRequest bool,
|
||||||
|
nameIDFormat *domain.SAMLNameIDFormat,
|
||||||
|
transientMappingAttributeName string,
|
||||||
options Options,
|
options Options,
|
||||||
) *SAMLIDPAddedEvent {
|
) *SAMLIDPAddedEvent {
|
||||||
return &SAMLIDPAddedEvent{
|
return &SAMLIDPAddedEvent{
|
||||||
BaseEvent: *base,
|
BaseEvent: *base,
|
||||||
ID: id,
|
ID: id,
|
||||||
Name: name,
|
Name: name,
|
||||||
Metadata: metadata,
|
Metadata: metadata,
|
||||||
Key: key,
|
Key: key,
|
||||||
Certificate: certificate,
|
Certificate: certificate,
|
||||||
Binding: binding,
|
Binding: binding,
|
||||||
WithSignedRequest: withSignedRequest,
|
WithSignedRequest: withSignedRequest,
|
||||||
Options: options,
|
NameIDFormat: nameIDFormat,
|
||||||
|
TransientMappingAttributeName: transientMappingAttributeName,
|
||||||
|
Options: options,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,13 +74,15 @@ func SAMLIDPAddedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|||||||
type SAMLIDPChangedEvent struct {
|
type SAMLIDPChangedEvent struct {
|
||||||
eventstore.BaseEvent `json:"-"`
|
eventstore.BaseEvent `json:"-"`
|
||||||
|
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
Metadata []byte `json:"metadata,omitempty"`
|
Metadata []byte `json:"metadata,omitempty"`
|
||||||
Key *crypto.CryptoValue `json:"key,omitempty"`
|
Key *crypto.CryptoValue `json:"key,omitempty"`
|
||||||
Certificate []byte `json:"certificate,omitempty"`
|
Certificate []byte `json:"certificate,omitempty"`
|
||||||
Binding *string `json:"binding,omitempty"`
|
Binding *string `json:"binding,omitempty"`
|
||||||
WithSignedRequest *bool `json:"withSignedRequest,omitempty"`
|
WithSignedRequest *bool `json:"withSignedRequest,omitempty"`
|
||||||
|
NameIDFormat *domain.SAMLNameIDFormat `json:"nameIDFormat,omitempty"`
|
||||||
|
TransientMappingAttributeName *string `json:"transientMappingAttributeName,omitempty"`
|
||||||
OptionChanges
|
OptionChanges
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,6 +142,18 @@ func ChangeSAMLWithSignedRequest(withSignedRequest bool) func(*SAMLIDPChangedEve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ChangeSAMLNameIDFormat(nameIDFormat *domain.SAMLNameIDFormat) func(*SAMLIDPChangedEvent) {
|
||||||
|
return func(e *SAMLIDPChangedEvent) {
|
||||||
|
e.NameIDFormat = nameIDFormat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ChangeSAMLTransientMappingAttributeName(name string) func(*SAMLIDPChangedEvent) {
|
||||||
|
return func(e *SAMLIDPChangedEvent) {
|
||||||
|
e.TransientMappingAttributeName = &name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func ChangeSAMLOptions(options OptionChanges) func(*SAMLIDPChangedEvent) {
|
func ChangeSAMLOptions(options OptionChanges) func(*SAMLIDPChangedEvent) {
|
||||||
return func(e *SAMLIDPChangedEvent) {
|
return func(e *SAMLIDPChangedEvent) {
|
||||||
e.OptionChanges = options
|
e.OptionChanges = options
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/crypto"
|
"github.com/zitadel/zitadel/internal/crypto"
|
||||||
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/eventstore"
|
"github.com/zitadel/zitadel/internal/eventstore"
|
||||||
"github.com/zitadel/zitadel/internal/repository/idp"
|
"github.com/zitadel/zitadel/internal/repository/idp"
|
||||||
)
|
)
|
||||||
@@ -1016,6 +1017,8 @@ func NewSAMLIDPAddedEvent(
|
|||||||
certificate []byte,
|
certificate []byte,
|
||||||
binding string,
|
binding string,
|
||||||
withSignedRequest bool,
|
withSignedRequest bool,
|
||||||
|
nameIDFormat *domain.SAMLNameIDFormat,
|
||||||
|
transientMappingAttributeName string,
|
||||||
options idp.Options,
|
options idp.Options,
|
||||||
) *SAMLIDPAddedEvent {
|
) *SAMLIDPAddedEvent {
|
||||||
return &SAMLIDPAddedEvent{
|
return &SAMLIDPAddedEvent{
|
||||||
@@ -1032,6 +1035,8 @@ func NewSAMLIDPAddedEvent(
|
|||||||
certificate,
|
certificate,
|
||||||
binding,
|
binding,
|
||||||
withSignedRequest,
|
withSignedRequest,
|
||||||
|
nameIDFormat,
|
||||||
|
transientMappingAttributeName,
|
||||||
options,
|
options,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zitadel/zitadel/internal/crypto"
|
"github.com/zitadel/zitadel/internal/crypto"
|
||||||
|
"github.com/zitadel/zitadel/internal/domain"
|
||||||
"github.com/zitadel/zitadel/internal/eventstore"
|
"github.com/zitadel/zitadel/internal/eventstore"
|
||||||
"github.com/zitadel/zitadel/internal/repository/idp"
|
"github.com/zitadel/zitadel/internal/repository/idp"
|
||||||
)
|
)
|
||||||
@@ -1017,6 +1018,8 @@ func NewSAMLIDPAddedEvent(
|
|||||||
certificate []byte,
|
certificate []byte,
|
||||||
binding string,
|
binding string,
|
||||||
withSignedRequest bool,
|
withSignedRequest bool,
|
||||||
|
nameIDFormat *domain.SAMLNameIDFormat,
|
||||||
|
transientMappingAttributeName string,
|
||||||
options idp.Options,
|
options idp.Options,
|
||||||
) *SAMLIDPAddedEvent {
|
) *SAMLIDPAddedEvent {
|
||||||
|
|
||||||
@@ -1034,6 +1037,8 @@ func NewSAMLIDPAddedEvent(
|
|||||||
certificate,
|
certificate,
|
||||||
binding,
|
binding,
|
||||||
withSignedRequest,
|
withSignedRequest,
|
||||||
|
nameIDFormat,
|
||||||
|
transientMappingAttributeName,
|
||||||
options,
|
options,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,6 +534,7 @@ Errors:
|
|||||||
IDPMissing: IDP липсва в заявката
|
IDPMissing: IDP липсва в заявката
|
||||||
IDPInvalid: IDP невалиден за заявката
|
IDPInvalid: IDP невалиден за заявката
|
||||||
ResponseInvalid: Отговорът на IDP е невалиден
|
ResponseInvalid: Отговорът на IDP е невалиден
|
||||||
|
MissingSingleMappingAttribute: Не съдържа атрибута за съпоставяне или има повече от една стойност
|
||||||
SuccessURLMissing: В заявката липсва URL адрес за успех
|
SuccessURLMissing: В заявката липсва URL адрес за успех
|
||||||
FailureURLMissing: В заявката липсва URL адрес за грешка
|
FailureURLMissing: В заявката липсва URL адрес за грешка
|
||||||
StateMissing: В заявката липсва параметър състояние
|
StateMissing: В заявката липсва параметър състояние
|
||||||
|
|||||||
@@ -514,6 +514,7 @@ Errors:
|
|||||||
IDPMissing: V požadavku chybí IDP ID
|
IDPMissing: V požadavku chybí IDP ID
|
||||||
IDPInvalid: IDP je pro požadavek neplatné
|
IDPInvalid: IDP je pro požadavek neplatné
|
||||||
ResponseInvalid: Odpověď IDP je neplatná
|
ResponseInvalid: Odpověď IDP je neplatná
|
||||||
|
MissingSingleMappingAttribute: Neobsahuje atribut mapování nebo má více než jednu hodnotu
|
||||||
SuccessURLMissing: V požadavku chybí úspěšná URL
|
SuccessURLMissing: V požadavku chybí úspěšná URL
|
||||||
FailureURLMissing: V požadavku chybí URL selhání
|
FailureURLMissing: V požadavku chybí URL selhání
|
||||||
StateMissing: V požadavku chybí parametr stavu
|
StateMissing: V požadavku chybí parametr stavu
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ Errors:
|
|||||||
IDPMissing: IDP ID fehlt im Request
|
IDPMissing: IDP ID fehlt im Request
|
||||||
IDPInvalid: IDP ungültig für die Anfrage
|
IDPInvalid: IDP ungültig für die Anfrage
|
||||||
ResponseInvalid: IDP-Antwort ist ungültig
|
ResponseInvalid: IDP-Antwort ist ungültig
|
||||||
|
MissingSingleMappingAttribute: Enthält das Zuordnungsattribut nicht oder hat mehr als einen Wert
|
||||||
SuccessURLMissing: Success URL fehlt im Request
|
SuccessURLMissing: Success URL fehlt im Request
|
||||||
FailureURLMissing: Failure URL fehlt im Request
|
FailureURLMissing: Failure URL fehlt im Request
|
||||||
StateMissing: State parameter fehlt im Request
|
StateMissing: State parameter fehlt im Request
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ Errors:
|
|||||||
IDPMissing: IDP ID is missing in the request
|
IDPMissing: IDP ID is missing in the request
|
||||||
IDPInvalid: IDP invalid for the request
|
IDPInvalid: IDP invalid for the request
|
||||||
ResponseInvalid: IDP response is invalid
|
ResponseInvalid: IDP response is invalid
|
||||||
|
MissingSingleMappingAttribute: IDP response does not contain the mapping attribute or has more than one value
|
||||||
SuccessURLMissing: Success URL is missing in the request
|
SuccessURLMissing: Success URL is missing in the request
|
||||||
FailureURLMissing: Failure URL is missing in the request
|
FailureURLMissing: Failure URL is missing in the request
|
||||||
StateMissing: State parameter is missing in the request
|
StateMissing: State parameter is missing in the request
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ Errors:
|
|||||||
IDPMissing: Falta IDP en la solicitud
|
IDPMissing: Falta IDP en la solicitud
|
||||||
IDPInvalid: IDP no válido para la solicitud
|
IDPInvalid: IDP no válido para la solicitud
|
||||||
ResponseInvalid: La respuesta del IDP no es válida
|
ResponseInvalid: La respuesta del IDP no es válida
|
||||||
|
MissingSingleMappingAttribute: No contiene el atributo de asignación o tiene más de un valor
|
||||||
SuccessURLMissing: Falta la URL de éxito en la solicitud
|
SuccessURLMissing: Falta la URL de éxito en la solicitud
|
||||||
FailureURLMissing: Falta la URL de error en la solicitud
|
FailureURLMissing: Falta la URL de error en la solicitud
|
||||||
StateMissing: Falta un parámetro de estado en la solicitud
|
StateMissing: Falta un parámetro de estado en la solicitud
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ Errors:
|
|||||||
IDPMissing: IDP manquant dans la requête
|
IDPMissing: IDP manquant dans la requête
|
||||||
IDPInvalid: IDP non valide pour la demande
|
IDPInvalid: IDP non valide pour la demande
|
||||||
ResponseInvalid: La réponse de l'IDP n'est pas valide
|
ResponseInvalid: La réponse de l'IDP n'est pas valide
|
||||||
|
MissingSingleMappingAttribute: Ne contient pas l'attribut de mappage ou a plus d'une valeur
|
||||||
SuccessURLMissing: Success URL absent de la requête
|
SuccessURLMissing: Success URL absent de la requête
|
||||||
FailureURLMissing: Failure URL absent de la requête
|
FailureURLMissing: Failure URL absent de la requête
|
||||||
StateMissing: Paramètre d'état manquant dans la requête
|
StateMissing: Paramètre d'état manquant dans la requête
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ Errors:
|
|||||||
IDPMissing: IDP mancante nella richiesta
|
IDPMissing: IDP mancante nella richiesta
|
||||||
IDPInvalid: IDP non valido per la richiesta
|
IDPInvalid: IDP non valido per la richiesta
|
||||||
ResponseInvalid: La risposta dell'IDP non è valida
|
ResponseInvalid: La risposta dell'IDP non è valida
|
||||||
|
MissingSingleMappingAttribute: Non contiene l'attributo di mapping o ha più di un valore
|
||||||
SuccessURLMissing: URL di successo mancante nella richiesta
|
SuccessURLMissing: URL di successo mancante nella richiesta
|
||||||
FailureURLMissing: URL di errore mancante nella richiesta
|
FailureURLMissing: URL di errore mancante nella richiesta
|
||||||
StateMissing: parametro di stato mancante nella richiesta
|
StateMissing: parametro di stato mancante nella richiesta
|
||||||
|
|||||||
@@ -505,6 +505,7 @@ Errors:
|
|||||||
IDPMissing: リクエストにIDP IDが含まれていません
|
IDPMissing: リクエストにIDP IDが含まれていません
|
||||||
IDPInvalid: リクエストのIDPが無効
|
IDPInvalid: リクエストのIDPが無効
|
||||||
ResponseInvalid: IDPの回答は無効
|
ResponseInvalid: IDPの回答は無効
|
||||||
|
MissingSingleMappingAttribute: マッピング属性が含まれていない、または複数の値がある
|
||||||
SuccessURLMissing: リクエストに成功時の URL がありません
|
SuccessURLMissing: リクエストに成功時の URL がありません
|
||||||
FailureURLMissing: リクエストに失敗の URL がありません
|
FailureURLMissing: リクエストに失敗の URL がありません
|
||||||
StateMissing: リクエストに State パラメータがありません
|
StateMissing: リクエストに State パラメータがありません
|
||||||
|
|||||||
@@ -515,6 +515,7 @@ Errors:
|
|||||||
IDPMissing: ID на IDP недостасува во барањето6bg
|
IDPMissing: ID на IDP недостасува во барањето6bg
|
||||||
IDPInvalid: ВРЛ неважечки за барањето
|
IDPInvalid: ВРЛ неважечки за барањето
|
||||||
ResponseInvalid: Одговорот на ВРЛ е неважечки
|
ResponseInvalid: Одговорот на ВРЛ е неважечки
|
||||||
|
MissingSingleMappingAttribute: не го содржи атрибутот за мапирање или има повеќе од една вредност
|
||||||
SuccessURLMissing: URL за успех недостасува во барањето
|
SuccessURLMissing: URL за успех недостасува во барањето
|
||||||
FailureURLMissing: URL за неуспех недостасува во барањето
|
FailureURLMissing: URL за неуспех недостасува во барањето
|
||||||
StateMissing: Параметарот State недостасува во барањето
|
StateMissing: Параметарот State недостасува во барањето
|
||||||
|
|||||||
@@ -515,6 +515,7 @@ Errors:
|
|||||||
IDPMissing: IDP ID ontbreekt in het verzoek
|
IDPMissing: IDP ID ontbreekt in het verzoek
|
||||||
IDPInvalid: IDP ongeldig voor het verzoek
|
IDPInvalid: IDP ongeldig voor het verzoek
|
||||||
ResponseInvalid: IDP respons is ongeldig
|
ResponseInvalid: IDP respons is ongeldig
|
||||||
|
MissingSingleMappingAttribute: Bevat kenmerk toewijzing niet of heeft meer dan één waarde
|
||||||
SuccessURLMissing: Success URL ontbreekt in het verzoek
|
SuccessURLMissing: Success URL ontbreekt in het verzoek
|
||||||
FailureURLMissing: Failure URL ontbreekt in het verzoek
|
FailureURLMissing: Failure URL ontbreekt in het verzoek
|
||||||
StateMissing: Staat parameter ontbreekt in het verzoek
|
StateMissing: Staat parameter ontbreekt in het verzoek
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ Errors:
|
|||||||
IDPMissing: Brak identyfikatora IDP w żądaniu
|
IDPMissing: Brak identyfikatora IDP w żądaniu
|
||||||
IDPInvalid: IDP nieprawidłowe dla żądania
|
IDPInvalid: IDP nieprawidłowe dla żądania
|
||||||
ResponseInvalid: Odpowiedź IDP jest nieprawidłowa
|
ResponseInvalid: Odpowiedź IDP jest nieprawidłowa
|
||||||
|
MissingSingleMappingAttribute: Nie zawiera atrybutu mapowania lub ma więcej niż jedną wartość
|
||||||
SuccessURLMissing: Brak adresu URL powodzenia w żądaniu
|
SuccessURLMissing: Brak adresu URL powodzenia w żądaniu
|
||||||
FailureURLMissing: Brak adresu URL niepowodzenia w żądaniu
|
FailureURLMissing: Brak adresu URL niepowodzenia w żądaniu
|
||||||
StateMissing: Brak parametru stanu w żądaniu
|
StateMissing: Brak parametru stanu w żądaniu
|
||||||
|
|||||||
@@ -515,6 +515,7 @@ Errors:
|
|||||||
IDPMissing: O ID do IDP está faltando na solicitação
|
IDPMissing: O ID do IDP está faltando na solicitação
|
||||||
IDPInvalid: IDP inválido para o pedido
|
IDPInvalid: IDP inválido para o pedido
|
||||||
ResponseInvalid: A resposta da PDI é inválida
|
ResponseInvalid: A resposta da PDI é inválida
|
||||||
|
MissingSingleMappingAttribute: Não contém o atributo de mapeamento ou tem mais de um valor
|
||||||
SuccessURLMissing: A URL de sucesso está faltando na solicitação
|
SuccessURLMissing: A URL de sucesso está faltando na solicitação
|
||||||
FailureURLMissing: A URL de falha está faltando na solicitação
|
FailureURLMissing: A URL de falha está faltando na solicitação
|
||||||
StateMissing: O parâmetro de estado está faltando na solicitação
|
StateMissing: O parâmetro de estado está faltando na solicitação
|
||||||
|
|||||||
@@ -505,6 +505,7 @@ Errors:
|
|||||||
NoChallenge: Сеанс без вызова WebAuthN
|
NoChallenge: Сеанс без вызова WebAuthN
|
||||||
Intent:
|
Intent:
|
||||||
IDPMissing: В запросе отсутствует идентификатор IDP
|
IDPMissing: В запросе отсутствует идентификатор IDP
|
||||||
|
MissingSingleMappingAttribute: Не содержит атрибут сопоставления или имеет более одного значения
|
||||||
SuccessURLMissing: В запросе отсутствует URL-адрес успешного выполнения
|
SuccessURLMissing: В запросе отсутствует URL-адрес успешного выполнения
|
||||||
FailureURLMissing: В запросе отсутствует URL-адрес ошибки
|
FailureURLMissing: В запросе отсутствует URL-адрес ошибки
|
||||||
StateMissing: В запросе отсутствует параметр State
|
StateMissing: В запросе отсутствует параметр State
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ Errors:
|
|||||||
IDPMissing: 请求中缺少IDP ID
|
IDPMissing: 请求中缺少IDP ID
|
||||||
IDPInvalid: 请求的 IDP 无效
|
IDPInvalid: 请求的 IDP 无效
|
||||||
ResponseInvalid: IDP 响应无效
|
ResponseInvalid: IDP 响应无效
|
||||||
|
MissingSingleMappingAttribute: 不包含映射属性或具有多个值
|
||||||
SuccessURLMissing: 请求中缺少成功URL
|
SuccessURLMissing: 请求中缺少成功URL
|
||||||
FailureURLMissing: 请求中缺少失败的URL
|
FailureURLMissing: 请求中缺少失败的URL
|
||||||
StateMissing: 请求中缺少状态参数
|
StateMissing: 请求中缺少状态参数
|
||||||
|
|||||||
+24
-30
@@ -6028,31 +6028,28 @@ message AddSAMLProviderRequest {
|
|||||||
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
||||||
oneof metadata {
|
oneof metadata {
|
||||||
option (validate.required) = true;
|
option (validate.required) = true;
|
||||||
|
// Metadata of the SAML identity provider.
|
||||||
bytes metadata_xml = 2 [
|
bytes metadata_xml = 2 [
|
||||||
(validate.rules).bytes.max_len = 500000,
|
(validate.rules).bytes.max_len = 500000
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Metadata of the SAML identity provider";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
// Url to the metadata of the SAML identity provider.
|
||||||
string metadata_url = 3 [
|
string metadata_url = 3 [
|
||||||
(validate.rules).string.max_len = 200,
|
(validate.rules).string.max_len = 200,
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||||
example: "\"https://test.com/saml/metadata\""
|
example: "\"https://test.com/saml/metadata\""
|
||||||
description: "Url to the metadata of the SAML identity provider";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
zitadel.idp.v1.SAMLBinding binding = 4 [
|
// Binding which defines the type of communication with the identity provider.
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
zitadel.idp.v1.SAMLBinding binding = 4;
|
||||||
description: "Binding which defines the type of communication with the identity provider";
|
// Boolean which defines if the authentication requests are signed.
|
||||||
}
|
bool with_signed_request = 5;
|
||||||
];
|
|
||||||
bool with_signed_request = 5 [
|
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Boolean which defines if the authentication requests are signed";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
zitadel.idp.v1.Options provider_options = 6;
|
zitadel.idp.v1.Options provider_options = 6;
|
||||||
|
// Optionally specify the `nameid-format` requested.
|
||||||
|
optional zitadel.idp.v1.SAMLNameIDFormat name_id_format = 7;
|
||||||
|
// Optionally specify the name of the attribute, which will be used to map the user
|
||||||
|
// in case the nameid-format returned is `urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
|
||||||
|
optional string transient_mapping_attribute_name = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddSAMLProviderResponse {
|
message AddSAMLProviderResponse {
|
||||||
@@ -6063,33 +6060,30 @@ message AddSAMLProviderResponse {
|
|||||||
message UpdateSAMLProviderRequest {
|
message UpdateSAMLProviderRequest {
|
||||||
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
||||||
string name = 2 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
string name = 2 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
||||||
|
// Metadata of the SAML identity provider.
|
||||||
oneof metadata {
|
oneof metadata {
|
||||||
option (validate.required) = true;
|
option (validate.required) = true;
|
||||||
bytes metadata_xml = 3 [
|
bytes metadata_xml = 3 [
|
||||||
(validate.rules).bytes.max_len = 500000,
|
(validate.rules).bytes.max_len = 500000
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Metadata of the SAML identity provider";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
// Url to the metadata of the SAML identity provider
|
||||||
string metadata_url = 4 [
|
string metadata_url = 4 [
|
||||||
(validate.rules).string.max_len = 200,
|
(validate.rules).string.max_len = 200,
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||||
example: "\"https://test.com/saml/metadata\""
|
example: "\"https://test.com/saml/metadata\""
|
||||||
description: "Url to the metadata of the SAML identity provider";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
zitadel.idp.v1.SAMLBinding binding = 5 [
|
// Binding which defines the type of communication with the identity provider.
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
zitadel.idp.v1.SAMLBinding binding = 5;
|
||||||
description: "Binding which defines the type of communication with the identity provider";
|
// Boolean which defines if the authentication requests are signed
|
||||||
}
|
bool with_signed_request = 6;
|
||||||
];
|
|
||||||
bool with_signed_request = 6 [
|
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Boolean which defines if the authentication requests are signed";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
zitadel.idp.v1.Options provider_options = 7;
|
zitadel.idp.v1.Options provider_options = 7;
|
||||||
|
// Optionally specify the `nameid-format` requested.
|
||||||
|
optional zitadel.idp.v1.SAMLNameIDFormat name_id_format = 8;
|
||||||
|
// Optionally specify the name of the attribute, which will be used to map the user
|
||||||
|
// in case the nameid-format returned is `urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
|
||||||
|
optional string transient_mapping_attribute_name = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UpdateSAMLProviderResponse {
|
message UpdateSAMLProviderResponse {
|
||||||
|
|||||||
+18
-15
@@ -276,6 +276,13 @@ enum SAMLBinding {
|
|||||||
SAML_BINDING_ARTIFACT = 3;
|
SAML_BINDING_ARTIFACT = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum SAMLNameIDFormat {
|
||||||
|
SAML_NAME_ID_FORMAT_UNSPECIFIED = 0;
|
||||||
|
SAML_NAME_ID_FORMAT_EMAIL_ADDRESS = 1;
|
||||||
|
SAML_NAME_ID_FORMAT_PERSISTENT = 2;
|
||||||
|
SAML_NAME_ID_FORMAT_TRANSIENT = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message ProviderConfig {
|
message ProviderConfig {
|
||||||
Options options = 1;
|
Options options = 1;
|
||||||
oneof config {
|
oneof config {
|
||||||
@@ -452,21 +459,17 @@ message LDAPConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message SAMLConfig {
|
message SAMLConfig {
|
||||||
bytes metadata_xml = 1 [
|
// Metadata of the SAML identity provider.
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
bytes metadata_xml = 1;
|
||||||
description: "Metadata of the SAML identity provider";
|
// Binding which defines the type of communication with the identity provider.
|
||||||
}
|
zitadel.idp.v1.SAMLBinding binding = 2;
|
||||||
];
|
// Boolean which defines if the authentication requests are signed.
|
||||||
zitadel.idp.v1.SAMLBinding binding = 2 [
|
bool with_signed_request = 3;
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
// `nameid-format` for the SAML Request.
|
||||||
description: "Binding which defines the type of communication with the identity provider";
|
zitadel.idp.v1.SAMLNameIDFormat name_id_format = 4;
|
||||||
}
|
// Optional name of the attribute, which will be used to map the user
|
||||||
];
|
// in case the nameid-format returned is `urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
|
||||||
bool with_signed_request = 3 [
|
optional string transient_mapping_attribute_name = 5;
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Boolean which defines if the authentication requests are signed";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message AzureADConfig {
|
message AzureADConfig {
|
||||||
|
|||||||
@@ -12767,31 +12767,28 @@ message AddSAMLProviderRequest {
|
|||||||
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
||||||
oneof metadata {
|
oneof metadata {
|
||||||
option (validate.required) = true;
|
option (validate.required) = true;
|
||||||
|
// Metadata of the SAML identity provider.
|
||||||
bytes metadata_xml = 2 [
|
bytes metadata_xml = 2 [
|
||||||
(validate.rules).bytes.max_len = 500000,
|
(validate.rules).bytes.max_len = 500000
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Metadata of the SAML identity provider";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
// Url to the metadata of the SAML identity provider.
|
||||||
string metadata_url = 3 [
|
string metadata_url = 3 [
|
||||||
(validate.rules).string.max_len = 200,
|
(validate.rules).string.max_len = 200,
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||||
example: "\"https://test.com/saml/metadata\""
|
example: "\"https://test.com/saml/metadata\""
|
||||||
description: "Url to the metadata of the SAML identity provider";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
zitadel.idp.v1.SAMLBinding binding = 4 [
|
// Binding which defines the type of communication with the identity provider.
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
zitadel.idp.v1.SAMLBinding binding = 4;
|
||||||
description: "Binding which defines the type of communication with the identity provider";
|
// Boolean which defines if the authentication requests are signed.
|
||||||
}
|
bool with_signed_request = 5;
|
||||||
];
|
|
||||||
bool with_signed_request = 5 [
|
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Boolean which defines if the authentication requests are signed";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
zitadel.idp.v1.Options provider_options = 6;
|
zitadel.idp.v1.Options provider_options = 6;
|
||||||
|
// Optionally specify the `nameid-format` requested.
|
||||||
|
optional zitadel.idp.v1.SAMLNameIDFormat name_id_format = 7;
|
||||||
|
// Optionally specify the name of the attribute, which will be used to map the user
|
||||||
|
// in case the nameid-format returned is `urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
|
||||||
|
optional string transient_mapping_attribute_name = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddSAMLProviderResponse {
|
message AddSAMLProviderResponse {
|
||||||
@@ -12802,33 +12799,30 @@ message AddSAMLProviderResponse {
|
|||||||
message UpdateSAMLProviderRequest {
|
message UpdateSAMLProviderRequest {
|
||||||
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
||||||
string name = 2 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
string name = 2 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
||||||
|
// Metadata of the SAML identity provider.
|
||||||
oneof metadata {
|
oneof metadata {
|
||||||
option (validate.required) = true;
|
option (validate.required) = true;
|
||||||
bytes metadata_xml = 3 [
|
bytes metadata_xml = 3 [
|
||||||
(validate.rules).bytes.max_len = 500000,
|
(validate.rules).bytes.max_len = 500000
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Metadata of the SAML identity provider";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
// Url to the metadata of the SAML identity provider.
|
||||||
string metadata_url = 4 [
|
string metadata_url = 4 [
|
||||||
(validate.rules).string.max_len = 200,
|
(validate.rules).string.max_len = 200,
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||||
example: "\"https://test.com/saml/metadata\""
|
example: "\"https://test.com/saml/metadata\""
|
||||||
description: "Url to the metadata of the SAML identity provider";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
zitadel.idp.v1.SAMLBinding binding = 5 [
|
// Binding which defines the type of communication with the identity provider.
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
zitadel.idp.v1.SAMLBinding binding = 5;
|
||||||
description: "Binding which defines the type of communication with the identity provider";
|
// Boolean which defines if the authentication requests are signed.
|
||||||
}
|
bool with_signed_request = 6;
|
||||||
];
|
|
||||||
bool with_signed_request = 6 [
|
|
||||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
||||||
description: "Boolean which defines if the authentication requests are signed";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
zitadel.idp.v1.Options provider_options = 7;
|
zitadel.idp.v1.Options provider_options = 7;
|
||||||
|
// Optionally specify the `nameid-format` requested.
|
||||||
|
optional zitadel.idp.v1.SAMLNameIDFormat name_id_format = 8;
|
||||||
|
// Optionally specify the name of the attribute, which will be used to map the user
|
||||||
|
// in case the nameid-format returned is `urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
|
||||||
|
optional string transient_mapping_attribute_name = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UpdateSAMLProviderResponse {
|
message UpdateSAMLProviderResponse {
|
||||||
|
|||||||
Reference in New Issue
Block a user