Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete account linking in authflow
- Loading branch information
Showing
35 changed files
with
1,287 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
pkg/lib/authenticationflow/declarative/data_account_linking.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package declarative | ||
|
||
import ( | ||
authflow "github.com/authgear/authgear-server/pkg/lib/authenticationflow" | ||
"github.com/authgear/authgear-server/pkg/lib/authn/identity" | ||
"github.com/authgear/authgear-server/pkg/lib/config" | ||
"github.com/authgear/authgear-server/pkg/util/slice" | ||
) | ||
|
||
type AccountLinkingIdentificationOption struct { | ||
Identifcation config.AuthenticationFlowIdentification `json:"identification"` | ||
MaskedDisplayName string `json:"masked_display_name,omitempty"` | ||
|
||
// ProviderType is specific to OAuth. | ||
ProviderType config.OAuthSSOProviderType `json:"provider_type,omitempty"` | ||
// Alias is specific to OAuth. | ||
Alias string `json:"alias,omitempty"` | ||
} | ||
|
||
type AccountLinkingIdentificationOptionInternal struct { | ||
AccountLinkingIdentificationOption | ||
Identity *identity.Info | ||
} | ||
|
||
type AccountLinkingIdentifyData struct { | ||
TypedData | ||
Options []AccountLinkingIdentificationOption `json:"options"` | ||
} | ||
|
||
var _ authflow.Data = AccountLinkingIdentifyData{} | ||
|
||
func (AccountLinkingIdentifyData) Data() {} | ||
|
||
func NewAccountLinkingIdentifyData(options []AccountLinkingIdentificationOptionInternal) AccountLinkingIdentifyData { | ||
return AccountLinkingIdentifyData{ | ||
TypedData: TypedData{Type: DataTypeAccountLinkingIdentificationData}, | ||
Options: slice.Map(options, func(o AccountLinkingIdentificationOptionInternal) AccountLinkingIdentificationOption { | ||
return o.AccountLinkingIdentificationOption | ||
}), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.