usso

package
v0.0.0-...-58e1b79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

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

func JWTExtractor(r *http.Request) (string, error)

JWTExtractor extracts the JWT from a request and returns the token string. The token is not verified.

func LoginHandler

func LoginHandler(settings *config.Settings, 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

func NewJWTToken(jwtSecret string, resp *openid.Response, role int) (string, error)

NewJWTToken creates a new JWT from the verified OpenID response

func VerifyJWT

func VerifyJWT(jwtSecret, jwtToken string) (*jwt.Token, error)

VerifyJWT checks that we have a valid token

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL