Documentation
¶
Index ¶
- func CompareBcrypt(hash, password string) error
- func EncodeState(state State) (string, error)
- type AccessClient
- type AccessTokenErrorResponse
- type AccessTokenRequest
- type AccessTokenResponse
- type Cert
- type JWK
- type JWKSResponse
- type Oauth2
- func (m *Oauth2) APIAuth(w http.ResponseWriter, r *http.Request)
- func (m *Oauth2) APICerts(w http.ResponseWriter, r *http.Request)
- func (m *Oauth2) APILogout(w http.ResponseWriter, _ *http.Request)
- func (m *Oauth2) APIToken(w http.ResponseWriter, r *http.Request)
- func (m *Oauth2) CodeAuth(w http.ResponseWriter, r *http.Request)
- func (m *Oauth2) GenerateToken(w http.ResponseWriter, userID string, user *data.UserExtended, clientID string, ...)
- func (m *Oauth2) GetAccessClient(clientID, clientSecret string) (*AccessClient, *AccessTokenErrorResponse)
- func (m *Oauth2) Init() error
- func (m *Oauth2) Middleware(ctx context.Context) (func(http.Handler) http.Handler, error)
- func (m *Oauth2) MuxSet(prefix string) *chi.Mux
- type RSAKey
- type State
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareBcrypt ¶
func EncodeState ¶
Types ¶
type AccessClient ¶
type AccessTokenErrorResponse ¶
type AccessTokenErrorResponse struct { Error string `json:"error"` ErrorDescription string `json:"error_description"` // contains filtered or unexported fields }
func (AccessTokenErrorResponse) GetCode ¶
func (e AccessTokenErrorResponse) GetCode() int
type AccessTokenRequest ¶
type AccessTokenRequest struct { GrantType string `form:"grant_type"` Scope string `form:"scope,omitempty"` RefreshToken string `form:"refresh_token,omitempty"` Username string `form:"username,omitempty"` Password string `form:"password,omitempty"` RedirectURI string `form:"redirect_uri,omitempty"` Code string `form:"code,omitempty"` }
type AccessTokenResponse ¶
type JWK ¶
type JWK struct { KID string `json:"kid"` KTY string `json:"kty"` ALG string `json:"alg"` Use string `json:"use"` N string `json:"n"` E string `json:"e"` X5C []string `json:"x5c,omitempty"` }
JWK represents a JSON Web Key.
type JWKSResponse ¶
type JWKSResponse struct {
Keys []JWK `json:"keys"`
}
JWKSResponse represents the JSON Web Key Set response structure.
type Oauth2 ¶
type Oauth2 struct { PrefixPath string `cfg:"prefix_path"` Token Token `cfg:"token"` IamMiddleware string `cfg:"iam_middleware"` AccessClients map[string]AccessClient `cfg:"access_clients"` // Providers for get token from there but return token from here. Providers map[string]*session.Oauth2 `cfg:"providers"` // Code for code auth flow. Code auth.Code `cfg:"code"` // Store for cache temporary data. Store store.Store `cfg:"store"` // contains filtered or unexported fields }
func (*Oauth2) APIAuth ¶
func (m *Oauth2) APIAuth(w http.ResponseWriter, r *http.Request)
APIAuth for auth endpoint implementation of oauth2.
- Authorization Code Grant
func (*Oauth2) APIToken ¶
func (m *Oauth2) APIToken(w http.ResponseWriter, r *http.Request)
APIToken for token endpoint implementation of oauth2.
func (*Oauth2) CodeAuth ¶
func (m *Oauth2) CodeAuth(w http.ResponseWriter, r *http.Request)
CodeAuth will receive callback and generate new token and respond to redirection.
func (*Oauth2) GenerateToken ¶
func (m *Oauth2) GenerateToken(w http.ResponseWriter, userID string, user *data.UserExtended, clientID string, scope []string, defScope []string)
func (*Oauth2) GetAccessClient ¶
func (m *Oauth2) GetAccessClient(clientID, clientSecret string) (*AccessClient, *AccessTokenErrorResponse)
func (*Oauth2) Middleware ¶
type RSAKey ¶
type RSAKey struct { PrivateKey string `cfg:"private_key"` PrivateKeyBase64 string `cfg:"private_key_base64"` PublicKey string `cfg:"public_key"` PublicKeyBase64 string `cfg:"public_key_base64"` // contains filtered or unexported fields }
func (*RSAKey) GetPrivateKey ¶
func (*RSAKey) GetPublicKey ¶
Click to show internal directories.
Click to hide internal directories.