Documentation
¶
Overview ¶
Package usso provides types and functionality for the Ubuntu Single Sign-on Server
Index ¶
- Constants
- Variables
- func AddJWTCookie(jwtToken string, w http.ResponseWriter)
- func JWTExtractor(r *http.Request) (string, error)
- func LoginHandler(nonce openid.NonceStore, w http.ResponseWriter, r *http.Request) (*openid.Response, *openid.Request, string, error)
- func LogoutHandler(w http.ResponseWriter, r *http.Request)
- func NewJWTToken(jwtSecret string, resp *openid.Response, role int) (string, error)
- func NewJWTTokenForClient(jwtSecret, username, fullname, email, tokenKey string, role int) (string, error)
- func VerifyJWT(jwtSecret, jwtToken string) (*jwt.Token, error)
Constants ¶
View Source
const ( ClaimsIdentity = "identity" ClaimsUsername = "username" ClaimsEmail = "email" ClaimsName = "name" ClaimsRole = "role" ClaimsAccountFilter = "accountFilter" StandardClaimExpiresAt = "exp" )
UserClaims holds the JWT custom claims for a user
View Source
const JWTCookie = "X-Auth-Token"
JWTCookie is the name of the cookie used to store the JWT
Variables ¶
View Source
var ClaimsKey struct{}
ClaimsKey is the context key for the JWT claims
Functions ¶
func AddJWTCookie ¶
func AddJWTCookie(jwtToken string, w http.ResponseWriter)
AddJWTCookie sets the JWT as a cookie
func JWTExtractor ¶
JWTExtractor extracts the JWT from a request and returns the token string. The token is not verified.
func LoginHandler ¶
func LoginHandler(nonce openid.NonceStore, w http.ResponseWriter, r *http.Request) (*openid.Response, *openid.Request, string, error)
LoginHandler processes the login for Ubuntu SSO
func LogoutHandler ¶
func LogoutHandler(w http.ResponseWriter, r *http.Request)
LogoutHandler logs the user out by removing the cookie and the JWT authorization header
func NewJWTToken ¶
NewJWTToken creates a new JWT from the verified OpenID response
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.