Documentation
¶
Index ¶
Constants ¶
View Source
const (
KeyRealm = "realm"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticate ¶
type Authenticate struct {
ClientID string `json:"clientID"`
ClientSecret string `json:"clientSecret"`
Realm string `json:"realm,omitempty"`
Scope string `json:"scope,omitempty"`
UserName *string `json:"username,omitempty"`
Password *string `json:"password,omitempty"`
}
Authenticate holds authentication information
type AuthenticationHandler ¶
type AuthenticationHandler interface {
AuthenticateClient(Authenticate) (*JWT, error)
AuthenticateUser(Authenticate) (*JWT, error)
RefreshToken(Refresh) (*JWT, error)
}
AuthenticationHandler is used to authenticate with the api
func NewAuthenticationHandler ¶
func NewAuthenticationHandler(gocloak gocloak.GoCloak, realm *string) AuthenticationHandler
NewAuthenticationHandler instantiates a new AuthenticationHandler Setting realm is optional
type AuthenticationMiddleWare ¶
type AuthenticationMiddleWare interface {
// Decodes the token and checks if it is valid
DecodeAndValidateToken(next echo.HandlerFunc) echo.HandlerFunc
CheckToken(next echo.HandlerFunc) echo.HandlerFunc
// The following 2 methods need higher permissions of the client in the realm
CheckTokenCustomHeader(next echo.HandlerFunc) echo.HandlerFunc
CheckScope(next echo.HandlerFunc) echo.HandlerFunc
}
AuthenticationMiddleWare is used to validate the JWT
func NewAuthenticationMiddleWare ¶
func NewAuthenticationMiddleWare(gocloak gocloak.GoCloak, realm, clientID, clientSecret, allowedScope string, customHeaderName *string) AuthenticationMiddleWare
NewAuthenticationMiddleWare instantiates a new AuthenticationMiddleWare.
type JWT ¶
type JWT struct {
AccessToken string `json:"accessToken"`
ExpiresIn int `json:"expiresIn"`
RefreshExpiresIn int `json:"refreshExpiresIn"`
RefreshToken string `json:"refreshToken"`
TokenType string `json:"tokenType"`
NotBeforePolicy int `json:"notBeforePolicy"`
SessionState string `json:"sessionState"`
Scope string `json:"scope"`
}
JWT is a JWT
Click to show internal directories.
Click to hide internal directories.