Documentation
¶
Index ¶
- Constants
- type AuthTokenInfo
- type Config
- type Issuer
- func (i *Issuer) Authz(w http.ResponseWriter, r *http.Request)
- func (i *Issuer) GetToken(authInfo *AuthTokenInfo) (string, error)
- func (i *Issuer) JWKS(w http.ResponseWriter, r *http.Request)
- func (i *Issuer) Login(user string, c *http.Client) error
- func (i *Issuer) MustGetToken(authInfo *AuthTokenInfo) string
- func (i *Issuer) OpenIDDiscovery(w http.ResponseWriter, r *http.Request)
- func (i *Issuer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (i *Issuer) Token(w http.ResponseWriter, r *http.Request)
- type Server
- type UserClaimFunc
Constants ¶
View Source
const ( TypeCode = "code" TypeAccessToken = "access_token" TypeRefreshToken = "refresh_token" )
View Source
const UserLoginCookie = "oprox_test_issuer_user"
UserLoginCookie specifies the user you want to login with that you dont have to specify the user manually in a test. Also see the Issuer.Login method.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthTokenInfo ¶
type AuthTokenInfo struct { Type string `json:"type"` ClientID string `json:"client_id"` Nonce string `json:"nonce"` Scope []string `json:"scope"` User string `json:"user"` // Claims add additional claims or overwrite existing claims. This // has to be of type map[string]any or struct. Claims any `json:"extra"` }
AuthTokenInfo is used to keep state between calls
type Config ¶
type Config struct { Logger *slog.Logger IssuerURL string TokenLifetime time.Duration GetUserClaims UserClaimFunc AccessTokenIsJWT bool }
Config for the Issuer
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type Issuer ¶
type Issuer struct { *Config Signer jose.Signer ServeMux *http.ServeMux // contains filtered or unexported fields }
Issuer is a test implementation for an OIDC/OAuth2 IDP.
func (*Issuer) MustGetToken ¶
func (i *Issuer) MustGetToken(authInfo *AuthTokenInfo) string
func (*Issuer) OpenIDDiscovery ¶
func (i *Issuer) OpenIDDiscovery(w http.ResponseWriter, r *http.Request)
type UserClaimFunc ¶
UserClaimFunc returns extra claims for a particular user.
func DefaultUserClaims ¶
func DefaultUserClaims() UserClaimFunc
func StaticUserClaims ¶
func StaticUserClaims(userMap map[string]map[string]any) UserClaimFunc
Click to show internal directories.
Click to hide internal directories.