package
0.5.4
Repository: https://github.com/chesscomputing/golib.git
Documentation: pkg.go.dev

# README

Authz module

This repository provides all necessary pieces for FOXDEN/CHESS authentication and authorization. It covers kerberos and JWT tokens, it provides necessary middleware for gin framework, etc.

# Functions

Helper function to extract bearer token from http request.
CodeChallenge generates code challenge from the code verifier (SHA256 + base64 URL encoding).
CodeVerifier generates a random code verifier of 43-128 characters.
FacebookCallBack provides gin handler for facebook callback to given endpoint.
FacebookOauthLogin provides gin handler for facebook oauth login.
GithubCallBack provides gin handler for github callback to given endpoint.
GithubOauthLogin provides gin handler for github oauth login.
GoogleCallBack provides gin handler for google callback to given endpoint.
GoogleOauthLogin provides gin handler for google oauth login.
Init initializes map of OAuth providers.
InspectToken extracts token attributes.
InspectTokenProviders inspects token against all participated providers and return TokenAttributes.
JWTAccessToken generates JWT access token with custom claims https://blog.canopas.com/jwt-in-golang-how-to-implement-token-based-authentication-298c89a26ffd.
RandomBytes generates random bytes from given size and seed.
RandomString generates random string using given seed and size.
ReadSecret provides unified way to read secret either from provided file or a string, and fall back to a default value if string is empty.
RequestToken gets token from http request.
ScopeTokenMiddleware provides token validation with specific scope.
TokenClaims returns token claims.
gin cookies https://gin-gonic.com/docs/examples/cookie/ more advanced use-case: https://stackoverflow.com/questions/66289603/use-existing-session-cookie-in-gin-router.
UserCredentials inspect http request and return user credentials from its token.

# Variables

OAuthProviders contains maps of all participated providers.

# Structs

Certs represents structure of JWKS uri.
Claims defines our JWT claims.
CustomClaims defines application specific claims.
Kerberos defines kerberos structure we use.
JWKSKeys struct represent structure of JWKS Keys.
OpenIDConfiguration holds configuration for OpenID Provider.
Provider holds all information about given provider.
Token represents access token structure.
TokenAttributes contains structure of access token attributes.
TokenInfo contains information about all tokens.