Documentation
¶
Index ¶
- Variables
- func CompareBcrypt(hash, password 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) APICodeAuth(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) APIUserInfo(w http.ResponseWriter, r *http.Request)
- func (m *Oauth2) APIWellKnown(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 Token
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultTokenLifetime = time.Minute * 15 DefaultRefreshLifetime = time.Hour * 24 )
Functions ¶
func CompareBcrypt ¶
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 AccessTokenResponse struct {
TokenType string `json:"token_type"`
AccessToken string `json:"access_token"`
ExpiresIn int64 `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
RefreshTokenExpiresIn int64 `json:"refresh_token_expires_in"`
Scope string `json:"scope,omitempty"`
IDToken string `json:"id_token,omitempty"`
}
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"`
// PassLower for pass lower case on password flow.
PassLower bool `cfg:"pass_lower"`
WellKnown map[string]map[string]any `cfg:"well_known"`
CustomInfo map[string]map[string]string `cfg:"custom_info"`
// 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) APICodeAuth ¶
func (m *Oauth2) APICodeAuth(w http.ResponseWriter, r *http.Request)
APICodeAuth will receive callback and generate new token and respond to redirection.
func (*Oauth2) APIToken ¶
func (m *Oauth2) APIToken(w http.ResponseWriter, r *http.Request)
APIToken for token endpoint implementation of oauth2.
func (*Oauth2) APIUserInfo ¶
func (m *Oauth2) APIUserInfo(w http.ResponseWriter, r *http.Request)
func (*Oauth2) APIWellKnown ¶
func (m *Oauth2) APIWellKnown(w http.ResponseWriter, r *http.Request)
func (*Oauth2) GenerateToken ¶
func (m *Oauth2) GenerateToken(w http.ResponseWriter, userID string, user *data.UserExtended, clientID string, scope []string, defScope []string, _ map[string]interface{})
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.