Versions in this module Expand all Collapse all v1 v1.1.2 Oct 11, 2024 v1.1.1 Oct 11, 2024 Changes in this version + const AuthorizationEndpoint + const CodeChallengeMethodPlain + const CodeChallengeMethodS256 + const DefaultKey + const DiscoveryEndpoint + const InternalServerError + const InvalidClient + const InvalidGrant + const InvalidRequest + const InvalidScope + const IssuerBase + const JWKSEndpoint + const TokenEndpoint + const UnsupportedGrantType + const UserinfoEndpoint + var ClaimsSupported = []string + var GrantTypesSupported = []string + var IDTokenSigningAlgValuesSupported = []string + var NowFunc = time.Now + var ResponseTypesSupported = []string + var ScopesSupported = []string + var SubjectTypesSupported = []string + var TokenEndpointAuthMethodsSupported = []string + func GenerateCodeChallenge(method, codeVerifier string) (string, error) + type CodeQueue struct + Queue []string + func (q *CodeQueue) Pop() (string, error) + func (q *CodeQueue) Push(code string) + type Config struct + AccessTTL time.Duration + ClientID string + ClientSecret string + CodeChallengeMethodsSupported []string + Issuer string + RefreshTTL time.Duration + type ErrorQueue struct + Queue []*ServerError + func (q *ErrorQueue) Pop() *ServerError + func (q *ErrorQueue) Push(se *ServerError) + type IDTokenClaims struct + Nonce string + type Keypair struct + Kid string + PrivateKey *rsa.PrivateKey + PublicKey *rsa.PublicKey + func DefaultKeypair() (*Keypair, error) + func NewKeypair(key *rsa.PrivateKey) (*Keypair, error) + func RandomKeypair(size int) (*Keypair, error) + func (k *Keypair) JWKS() ([]byte, error) + func (k *Keypair) KeyID() (string, error) + func (k *Keypair) SignJWT(claims jwt.Claims) (string, error) + func (k *Keypair) VerifyJWT(token string, nowFunc func() time.Time) (*jwt.Token, error) + type MockOIDC struct + AccessTTL time.Duration + ClientID string + ClientSecret string + CodeChallengeMethodsSupported []string + ErrorQueue *ErrorQueue + Keypair *Keypair + RefreshTTL time.Duration + Server *http.Server + SessionStore *SessionStore + UserQueue *UserQueue + func NewServer(key *rsa.PrivateKey) (*MockOIDC, error) + func Run() (*MockOIDC, error) + func RunTLS(cfg *tls.Config) (*MockOIDC, error) + func (m *MockOIDC) AddMiddleware(mw func(http.Handler) http.Handler) error + func (m *MockOIDC) Addr() string + func (m *MockOIDC) AuthorizationEndpoint() string + func (m *MockOIDC) Authorize(rw http.ResponseWriter, req *http.Request) + func (m *MockOIDC) Config() *Config + func (m *MockOIDC) Discovery(rw http.ResponseWriter, _ *http.Request) + func (m *MockOIDC) DiscoveryEndpoint() string + func (m *MockOIDC) FastForward(d time.Duration) time.Duration + func (m *MockOIDC) Issuer() string + func (m *MockOIDC) JWKS(rw http.ResponseWriter, _ *http.Request) + func (m *MockOIDC) JWKSEndpoint() string + func (m *MockOIDC) Now() time.Time + func (m *MockOIDC) QueueCode(code string) + func (m *MockOIDC) QueueError(se *ServerError) + func (m *MockOIDC) QueueUser(user User) + func (m *MockOIDC) Shutdown() error + func (m *MockOIDC) Start(ln net.Listener, cfg *tls.Config) error + func (m *MockOIDC) Token(rw http.ResponseWriter, req *http.Request) + func (m *MockOIDC) TokenEndpoint() string + func (m *MockOIDC) Userinfo(rw http.ResponseWriter, req *http.Request) + func (m *MockOIDC) UserinfoEndpoint() string + type MockUser struct + Address string + Email string + EmailVerified bool + Groups []string + Phone string + PreferredUsername string + Subject string + func DefaultUser() *MockUser + func (u *MockUser) Claims(scope []string, claims *IDTokenClaims) (jwt.Claims, error) + func (u *MockUser) ID() string + func (u *MockUser) Userinfo(scope []string) ([]byte, error) + type ServerError struct + Code int + Description string + Error string + type Session struct + CodeChallenge string + CodeChallengeMethod string + Granted bool + OIDCNonce string + Scopes []string + SessionID string + User User + func (s *Session) AccessToken(config *Config, kp *Keypair, now time.Time) (string, error) + func (s *Session) IDToken(config *Config, kp *Keypair, now time.Time) (string, error) + func (s *Session) RefreshToken(config *Config, kp *Keypair, now time.Time) (string, error) + type SessionStore struct + CodeQueue *CodeQueue + Store map[string]*Session + func NewSessionStore() *SessionStore + func (ss *SessionStore) GetSessionByID(id string) (*Session, error) + func (ss *SessionStore) GetSessionByToken(token *jwt.Token) (*Session, error) + func (ss *SessionStore) NewSession(scope string, nonce string, user User, codeChallenge string, ...) (*Session, error) + type User interface + Claims func([]string, *IDTokenClaims) (jwt.Claims, error) + ID func() string + Userinfo func([]string) ([]byte, error) + type UserQueue struct + Queue []User + func (q *UserQueue) Pop() User + func (q *UserQueue) Push(user User)