diff --git a/e2e/tests/oauth/demo_credential_provider.test.yaml b/e2e/tests/oauth/demo_credential_provider.test.yaml index e8dccb9208c..4c3d99b38e2 100644 --- a/e2e/tests/oauth/demo_credential_provider.test.yaml +++ b/e2e/tests/oauth/demo_credential_provider.test.yaml @@ -32,7 +32,20 @@ steps: result: | { "action": { - "type": "identify" + "type": "identify", + "data": { + "type": "identification_data", + "options": [ + { + "identification": "oauth", + "alias": "facebook", + "oauth_provider_alias": "facebook", + "provider_type": "facebook", + "oauth_provider_type": "facebook", + "provider_status": "using_demo_credentials" + } + ] + } } } @@ -53,6 +66,7 @@ steps: "type": "oauth_data", "alias": "facebook", "oauth_provider_type": "facebook", + "oauth_provider_alias": "facebook", "oauth_authorization_url": "[[string]]", "provider_status": "using_demo_credentials" } diff --git a/pkg/lib/authenticationflow/declarative/data_identification.go b/pkg/lib/authenticationflow/declarative/data_identification.go index d577323fb4c..c5499cbb9d0 100644 --- a/pkg/lib/authenticationflow/declarative/data_identification.go +++ b/pkg/lib/authenticationflow/declarative/data_identification.go @@ -26,10 +26,14 @@ type IdentificationOption struct { Identification model.AuthenticationFlowIdentification `json:"identification"` BotProtection *BotProtectionData `json:"bot_protection,omitempty"` - // ProviderType is specific to OAuth. + // ProviderType is specific to OAuth. Kept for backwards compatibility; use OAuthProviderType. ProviderType string `json:"provider_type,omitempty"` - // Alias is specific to OAuth. + // OAuthProviderType is the canonical name for ProviderType. + OAuthProviderType string `json:"oauth_provider_type,omitempty"` + // Alias is specific to OAuth. Kept for backwards compatibility; use OAuthProviderAlias. Alias string `json:"alias,omitempty"` + // OAuthProviderAlias is the canonical name for Alias. + OAuthProviderAlias string `json:"oauth_provider_alias,omitempty"` // WechatAppType is specific to OAuth. WechatAppType wechat.AppType `json:"wechat_app_type,omitempty"` // ProviderStatus is specific to OAuth. @@ -63,12 +67,14 @@ func NewIdentificationOptionsOAuth(flows authflow.Flows, oauthConfig *config.OAu status := p.ComputeProviderStatus(demoCredentials) output = append(output, IdentificationOption{ - Identification: model.AuthenticationFlowIdentificationOAuth, - BotProtection: GetBotProtectionData(flows, authflowCfg, appCfg), - ProviderType: p.AsProviderConfig().Type(), - Alias: p.Alias(), - WechatAppType: wechat.ProviderConfig(p).AppType(), - ProviderStatus: status, + Identification: model.AuthenticationFlowIdentificationOAuth, + BotProtection: GetBotProtectionData(flows, authflowCfg, appCfg), + ProviderType: p.AsProviderConfig().Type(), + OAuthProviderType: p.AsProviderConfig().Type(), + Alias: p.Alias(), + OAuthProviderAlias: p.Alias(), + WechatAppType: wechat.ProviderConfig(p).AppType(), + ProviderStatus: status, }) } } diff --git a/pkg/lib/authenticationflow/declarative/data_oauth.go b/pkg/lib/authenticationflow/declarative/data_oauth.go index 772df6a714d..93430e57f85 100644 --- a/pkg/lib/authenticationflow/declarative/data_oauth.go +++ b/pkg/lib/authenticationflow/declarative/data_oauth.go @@ -10,7 +10,9 @@ type OAuthProviderStatus = config.OAuthProviderStatus type OAuthData struct { TypedData + // Alias is kept for backwards compatibility; use OAuthProviderAlias. Alias string `json:"alias,omitempty"` + OAuthProviderAlias string `json:"oauth_provider_alias,omitempty"` OAuthProviderType string `json:"oauth_provider_type,omitempty"` OAuthAuthorizationURL string `json:"oauth_authorization_url,omitempty"` WechatAppType wechat.AppType `json:"wechat_app_type,omitempty"` diff --git a/pkg/lib/authenticationflow/declarative/utils_common.go b/pkg/lib/authenticationflow/declarative/utils_common.go index ed0382fc849..79c61676989 100644 --- a/pkg/lib/authenticationflow/declarative/utils_common.go +++ b/pkg/lib/authenticationflow/declarative/utils_common.go @@ -825,6 +825,7 @@ func getOAuthData(ctx context.Context, deps *authflow.Dependencies, opts GetOAut data = NewOAuthData(OAuthData{ Alias: opts.Alias, + OAuthProviderAlias: opts.Alias, OAuthProviderType: providerConfig.Type(), OAuthAuthorizationURL: authorizationURL, WechatAppType: wechat.ProviderConfig(providerConfig).AppType(),