Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion e2e/tests/oauth/demo_credential_provider.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
}
}

Expand All @@ -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"
}
Expand Down
22 changes: 14 additions & 8 deletions pkg/lib/authenticationflow/declarative/data_identification.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
})
}
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/lib/authenticationflow/declarative/data_oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions pkg/lib/authenticationflow/declarative/utils_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Loading