Documentation
¶
Index ¶
- type AuthenticationProvider
- type BasicAuthenticationProvider
- func (ap *BasicAuthenticationProvider) AuthenticateMiddleware(next http.Handler) http.Handler
- func (ap *BasicAuthenticationProvider) GetToken(w http.ResponseWriter, r *http.Request)
- func (ap *BasicAuthenticationProvider) GetUserInfoIfCredentialsAreCorrect(username string, password string) (map[string]interface{}, utils.AdvancedErrorInterface)
- func (ap *BasicAuthenticationProvider) Init()
- type LDAPAuthenticationProvider
- func (ap *LDAPAuthenticationProvider) AuthenticateMiddleware(next http.Handler) http.Handler
- func (ap *LDAPAuthenticationProvider) GetToken(w http.ResponseWriter, r *http.Request)
- func (ap *LDAPAuthenticationProvider) GetUserInfoIfCredentialsAreCorrect(username string, password string) (map[string]interface{}, utils.AdvancedErrorInterface)
- func (ap *LDAPAuthenticationProvider) Init()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationProvider ¶
type AuthenticationProvider interface { // Init initialize the provider Init() // AuthenticateMiddleware return the middleware used to check if the users are authenticated AuthenticateMiddleware(next http.Handler) http.Handler // TokenEndpoint return the middleware used to check if the users are authenticated GetToken(w http.ResponseWriter, r *http.Request) // GetUserInfoIfCorrect return the informations about the user if the provided credentials are correct, otherwise return nil GetUserInfoIfCredentialsAreCorrect(username string, password string) (map[string]interface{}, utils.AdvancedErrorInterface) }
AuthenticationProvider is a interface that wrap methods used to authenticate users
func BuildAuthenticationProvider ¶
func BuildAuthenticationProvider(conf config.AuthenticationProviderConfig, timeNow func() time.Time, log *logrus.Logger) AuthenticationProvider
BuildAuthenticationProvider return a authentication provider that match what is requested in the configuration It's initialized
type BasicAuthenticationProvider ¶
type BasicAuthenticationProvider struct { // Config contains the dataservice global configuration Config config.AuthenticationProviderConfig // TimeNow contains a function that return the current time TimeNow func() time.Time // Log contains logger formatted Log *logrus.Logger // contains filtered or unexported fields }
BasicAuthenticationProvider is the concrete implementation of AuthenticationProvider that provide a simple user authentication.
func (*BasicAuthenticationProvider) AuthenticateMiddleware ¶
func (ap *BasicAuthenticationProvider) AuthenticateMiddleware(next http.Handler) http.Handler
AuthenticateMiddleware return the middleware used to check if the users are authenticated
func (*BasicAuthenticationProvider) GetToken ¶
func (ap *BasicAuthenticationProvider) GetToken(w http.ResponseWriter, r *http.Request)
GetToken return the middleware used to check if the users are authenticated
func (*BasicAuthenticationProvider) GetUserInfoIfCredentialsAreCorrect ¶
func (ap *BasicAuthenticationProvider) GetUserInfoIfCredentialsAreCorrect(username string, password string) (map[string]interface{}, utils.AdvancedErrorInterface)
GetUserInfoIfCredentialsAreCorrect return the informations about the user if the provided credentials are correct, otherwise return nil
func (*BasicAuthenticationProvider) Init ¶
func (ap *BasicAuthenticationProvider) Init()
Init initializes the service and database
type LDAPAuthenticationProvider ¶
type LDAPAuthenticationProvider struct { // Config contains the dataservice global configuration Config config.AuthenticationProviderConfig // TimeNow contains a function that return the current time TimeNow func() time.Time // Log contains logger formatted Log *logrus.Logger Client *ldap.LDAPClient // contains filtered or unexported fields }
LDAPAuthenticationProvider is the concrete implementation of AuthenticationProvider that provide a LDAP user authentication.
func (*LDAPAuthenticationProvider) AuthenticateMiddleware ¶
func (ap *LDAPAuthenticationProvider) AuthenticateMiddleware(next http.Handler) http.Handler
AuthenticateMiddleware return the middleware used to check if the users are authenticated
func (*LDAPAuthenticationProvider) GetToken ¶
func (ap *LDAPAuthenticationProvider) GetToken(w http.ResponseWriter, r *http.Request)
GetToken return the middleware used to check if the users are authenticated
func (*LDAPAuthenticationProvider) GetUserInfoIfCredentialsAreCorrect ¶
func (ap *LDAPAuthenticationProvider) GetUserInfoIfCredentialsAreCorrect(username string, password string) (map[string]interface{}, utils.AdvancedErrorInterface)
GetUserInfoIfCredentialsAreCorrect return the informations about the user if the provided credentials are correct, otherwise return nil
func (*LDAPAuthenticationProvider) Init ¶
func (ap *LDAPAuthenticationProvider) Init()
Init initializes the service and database