auth

package
v0.0.0-...-8472d0d Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JWTTTL int

Functions

func AuthenticateCASUser

func AuthenticateCASUser(next http.Handler) http.Handler

AuthenticateUser uses CAS/JWT authentication to authenticate a user, flow is:

1. Check for valid, unexpired JWT. 2. Check to see if request is authenticated with CAS 3. If no - redirect to CAS login 4. If valid CAS authentication, issue a JWT token, storing it in a cookie.

To access the information stored in the JWT use something like: claims, ok := context.Request().Context().Value("client").(*jwt.Token).Claims.(jwt.MapClaims)

Where `claims` will reutrn a key value string of claims validated by the JWT.

Included in the context will also be the set groups the user is a part of under the key "user-groups" groups, ok := context.Request().Context().Value("user-groups").(map[string]bool)

the user will also be available in the context groups, ok := context.Request().Context().Value("user").(string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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