Documentation
¶
Index ¶
- type Client
- type Connection
- type IDToken
- type Request
- type Response
- type ResponseType
- type Server
- func (s *Server) AddStaticFS(filesystem fs.FS)
- func (s *Server) AddTemplateArg(key, value string)
- func (s *Server) AddTemplatesFS(filesystem fs.FS) error
- func (s *Server) GetConnection(r *http.Request) *Connection
- func (s *Server) NewClient(name, secret string) *Client
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetAuthenticator(f func(req *Request) Response)
- func (s *Server) SetConnection(r *http.Request, conn *Connection) *http.Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddAllowedRedirectURIs ¶ added in v0.0.2
func (*Client) AddAllowedRoles ¶ added in v0.0.2
AddAllowedRoles adds one or more roles to the list of the allowed roles for users. If there are no allowed roles, any user can log in. If there is at least one, the users must belong to one of them.
func (*Client) AddAllowedScopes ¶ added in v0.0.2
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
type IDToken ¶
type IDToken struct {
// Standard claims:
Issuer string `json:"iss"`
SubjectIdentifier string `json:"sub"`
Audience string `json:"aud"`
Expiration int64 `json:"exp"`
IssuedAt int64 `json:"iat"`
Nonce string `json:"nonce,omitempty"`
PreferredUsername string `json:"preferred_username,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
EmailVerified bool `json:"email_verified,omitempty"`
// Other claims:
Claims map[string]any
}
https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.2
func (IDToken) MarshalJSON ¶ added in v0.0.2
type Request ¶
type Request struct {
Session string // unique ID for this user.
Client string
Scopes []string // scopes the user has requested
Roles []string // list of allowed roles
Params map[string]string
}
A Request is a message sent from the OIDC server to the authenticator, asking if a given credentials are valid
type Response ¶
type Response struct {
Type ResponseType
// If Type == ResponseTypeLoginFailed we can send an error to the user:
Error string
// If Type == ResponseTypeRedirect we need the name of the next template
// and the list of params that will be used to call it:
Redirect string
Params map[string]string
// login for the user. It is usually the same sent in the request.
// Used in claims "sub" and "preferred_username".
Login string
// User name and surname. Used in claim "name".
Name string
// e-mail address. Used in claim "email".
Mail string
// Other claims:
Claims map[string]any
}
A Response is sent from the authenticator to the OIDC server, answering a Request.
type ResponseType ¶
type ResponseType int
const ( ResponseTypeInvalid ResponseType = iota ResponseTypeLoginOK // login is successful ResponseTypeLoginFailed // login failed ResponseTypeRedirect // login is OK so far, but we are not finished yet )
type Server ¶
type Server struct {
sync.Mutex // to access clients and connections
// contains filtered or unexported fields
}
func (*Server) AddStaticFS ¶
AddStaticFS adds the content of a filesystem (a fs.FS) to the list of static files served by a Server.
func (*Server) AddTemplateArg ¶ added in v0.0.5
func (*Server) AddTemplatesFS ¶ added in v0.0.2
AddTemplatesFS adds the files inside a fs.FS to the list of templates processed by a Server.
func (*Server) GetConnection ¶ added in v0.0.2
func (s *Server) GetConnection(r *http.Request) *Connection
SetConnection gets a Connection previously stored in a http.Request
func (*Server) SetAuthenticator ¶ added in v0.0.3
func (*Server) SetConnection ¶ added in v0.0.2
SetConnection stores a Connection in a http.Request
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
oidc-server
command
|
|
|
Package mergefs provides support for merging multiple filesystems together.
|
Package mergefs provides support for merging multiple filesystems together. |