40 lines
1 KiB
Go
40 lines
1 KiB
Go
|
package provider
|
||
|
|
||
|
type AuthProvider interface { // TODO: this should include stepping
|
||
|
AuthProviderMetadata
|
||
|
ProviderBase() AuthProviderBase
|
||
|
FlowSchema() []FlowSchemaItem
|
||
|
NewCredData() interface{}
|
||
|
ValidateCreds(reqMap map[string]interface{}) (user ProviderUser, success bool)
|
||
|
}
|
||
|
|
||
|
type ProviderUser interface {
|
||
|
AuthProviderMetadata
|
||
|
ProviderUserData() interface{}
|
||
|
}
|
||
|
|
||
|
type AuthProviderBase struct {
|
||
|
Name string `json:"name"`
|
||
|
ID *string `json:"id"`
|
||
|
Type string `json:"type"`
|
||
|
}
|
||
|
|
||
|
type AuthProviderMetadata interface {
|
||
|
ProviderName() string
|
||
|
ProviderID() *string
|
||
|
ProviderType() string
|
||
|
}
|
||
|
|
||
|
func (bp *AuthProviderBase) ProviderName() string { return bp.Name }
|
||
|
func (bp *AuthProviderBase) ProviderID() *string { return bp.ID }
|
||
|
func (bp *AuthProviderBase) ProviderType() string { return bp.Type }
|
||
|
func (bp *AuthProviderBase) ProviderBase() AuthProviderBase { return *bp }
|
||
|
|
||
|
type FlowSchemaItem struct {
|
||
|
Type string `json:"type"`
|
||
|
Name string `json:"name"`
|
||
|
Required bool `json:"required"`
|
||
|
}
|
||
|
|
||
|
|