Documentation
¶
Index ¶
- Constants
- Variables
- type ArkAuth
- type ArkAuthBase
- func (a *ArkAuthBase) Authenticate(profile *models.ArkProfile, authProfile *auth.ArkAuthProfile, ...) (*auth.ArkToken, error)
- func (a *ArkAuthBase) IsAuthenticated(profile *models.ArkProfile) bool
- func (a *ArkAuthBase) LoadAuthentication(profile *models.ArkProfile, refreshAuth bool) (*auth.ArkToken, error)
- func (a *ArkAuthBase) ResolveCachePostfix(authProfile *auth.ArkAuthProfile) string
- type ArkISPAuth
- func (a *ArkISPAuth) Authenticate(profile *models.ArkProfile, authProfile *auth.ArkAuthProfile, ...) (*auth.ArkToken, error)
- func (a *ArkISPAuth) AuthenticatorHumanReadableName() string
- func (a *ArkISPAuth) AuthenticatorName() string
- func (a *ArkISPAuth) DefaultAuthMethod() (auth.ArkAuthMethod, auth.ArkAuthMethodSettings)
- func (a *ArkISPAuth) IsAuthenticated(profile *models.ArkProfile) bool
- func (a *ArkISPAuth) LoadAuthentication(profile *models.ArkProfile, refreshAuth bool) (*auth.ArkToken, error)
- func (a *ArkISPAuth) SupportedAuthMethods() []auth.ArkAuthMethod
Constants ¶
const (
DefaultTokenLifetime = 3600
)
DefaultTokenLifetime is the default token lifetime in seconds.
Variables ¶
var ( // SupportedAuthenticatorsList is a list of supported authenticators. SupportedAuthenticatorsList = []ArkAuth{ NewArkISPAuth(true), } // SupportedAuthenticators is a map of supported authenticators. SupportedAuthenticators = func() map[string]ArkAuth { authenticators := make(map[string]ArkAuth) for _, auth := range SupportedAuthenticatorsList { authenticators[auth.AuthenticatorName()] = auth } return authenticators }() // SupportedAuthMethods is a list of supported authentication methods. SupportedAuthMethods = func() []auth.ArkAuthMethod { authMethods := make([]auth.ArkAuthMethod, 0) for _, auth := range SupportedAuthenticatorsList { for _, method := range auth.SupportedAuthMethods() { if !slices.Contains(authMethods, method) { authMethods = append(authMethods, method) } } } return authMethods }() )
Functions ¶
This section is empty.
Types ¶
type ArkAuth ¶
type ArkAuth interface {
// AuthenticatorName returns the name of the authenticator.
AuthenticatorName() string
// AuthenticatorHumanReadableName returns a human-readable name for the authenticator.
AuthenticatorHumanReadableName() string
// SupportedAuthMethods returns a list of supported authentication methods.
SupportedAuthMethods() []auth.ArkAuthMethod
// IsAuthenticated checks if the authentication is already loaded for the specified profile.
IsAuthenticated(profile *models.ArkProfile) bool
// DefaultAuthMethod returns the default authentication method and its settings.
DefaultAuthMethod() (auth.ArkAuthMethod, auth.ArkAuthMethodSettings)
// LoadAuthentication loads the authentication token for the specified profile and refreshes it if necessary.
// It returns the authentication token and an error if any occurred.
LoadAuthentication(profile *models.ArkProfile, refreshAuth bool) (*auth.ArkToken, error)
// Authenticate performs authentication using the specified profile and authentication profile.
// If profile is not passed (nil), will try to use the auth profile alone, but at least one of them needs to be passed
// Secret may optionally be passed if needed for the authentication type
// If force is true, it will force re-authentication even if a valid token is already present
// If refreshAuth is true, it will attempt to refresh the token if it is expired
// It returns the authentication token and an error if any occurred.
Authenticate(profile *models.ArkProfile, authProfile *auth.ArkAuthProfile, secret *auth.ArkSecret, force bool, refreshAuth bool) (*auth.ArkToken, error)
// contains filtered or unexported methods
}
ArkAuth is an interface that defines the methods for authentication in the Ark SDK.
func NewArkISPAuth ¶
NewArkISPAuth creates a new instance of ArkISPAuth.
type ArkAuthBase ¶
type ArkAuthBase struct {
Authenticator ArkAuth
Logger *common.ArkLogger
CacheAuthentication bool
CacheKeyring *keyring.ArkKeyring
Token *auth.ArkToken
ActiveProfile *models.ArkProfile
ActiveAuthProfile *auth.ArkAuthProfile
}
ArkAuthBase is a struct that implements the ArkAuth interface and provides common functionality for authentication.
func NewArkAuthBase ¶
func NewArkAuthBase(cacheAuthentication bool, name string, authenticator ArkAuth) *ArkAuthBase
NewArkAuthBase creates a new instance of ArkAuthBase.
func (*ArkAuthBase) Authenticate ¶
func (a *ArkAuthBase) Authenticate(profile *models.ArkProfile, authProfile *auth.ArkAuthProfile, secret *auth.ArkSecret, force bool, refreshAuth bool) (*auth.ArkToken, error)
Authenticate performs authentication using the specified profile and authentication profile.
func (*ArkAuthBase) IsAuthenticated ¶
func (a *ArkAuthBase) IsAuthenticated(profile *models.ArkProfile) bool
IsAuthenticated checks if the authentication is already loaded for the specified profile.
func (*ArkAuthBase) LoadAuthentication ¶
func (a *ArkAuthBase) LoadAuthentication(profile *models.ArkProfile, refreshAuth bool) (*auth.ArkToken, error)
LoadAuthentication loads the authentication token for the specified profile and refreshes it if necessary.
func (*ArkAuthBase) ResolveCachePostfix ¶
func (a *ArkAuthBase) ResolveCachePostfix(authProfile *auth.ArkAuthProfile) string
ResolveCachePostfix resolves the cache postfix for the authentication profile.
type ArkISPAuth ¶
type ArkISPAuth struct {
ArkAuth
*ArkAuthBase
}
ArkISPAuth is a struct that implements the ArkAuth interface for the Identity Security Platform.
func (*ArkISPAuth) Authenticate ¶
func (a *ArkISPAuth) Authenticate(profile *models.ArkProfile, authProfile *auth.ArkAuthProfile, secret *auth.ArkSecret, force bool, refreshAuth bool) (*auth.ArkToken, error)
Authenticate performs authentication using the specified profile and authentication profile.
func (*ArkISPAuth) AuthenticatorHumanReadableName ¶
func (a *ArkISPAuth) AuthenticatorHumanReadableName() string
AuthenticatorHumanReadableName returns the human-readable name of the ISP authenticator.
func (*ArkISPAuth) AuthenticatorName ¶
func (a *ArkISPAuth) AuthenticatorName() string
AuthenticatorName returns the name of the ISP authenticator.
func (*ArkISPAuth) DefaultAuthMethod ¶
func (a *ArkISPAuth) DefaultAuthMethod() (auth.ArkAuthMethod, auth.ArkAuthMethodSettings)
DefaultAuthMethod returns the default authentication method and its settings for the ISP authenticator.
func (*ArkISPAuth) IsAuthenticated ¶
func (a *ArkISPAuth) IsAuthenticated(profile *models.ArkProfile) bool
IsAuthenticated checks if the user is authenticated using the specified profile.
func (*ArkISPAuth) LoadAuthentication ¶
func (a *ArkISPAuth) LoadAuthentication(profile *models.ArkProfile, refreshAuth bool) (*auth.ArkToken, error)
LoadAuthentication loads the authentication token from the cache or performs authentication if not found.
func (*ArkISPAuth) SupportedAuthMethods ¶
func (a *ArkISPAuth) SupportedAuthMethods() []auth.ArkAuthMethod
SupportedAuthMethods returns the supported authentication methods for the ISP authenticator.