auth

package
v0.0.0-...-5419c58 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	GetRedirectURL(state string) string
	GetUserData(state, code string) (*user, error)
	GetOAuthProviderName() string
}

Adapter will be implemented by each oAuth provider

func NewGenericOIDCAdapter

func NewGenericOIDCAdapter(clientID, clientSecret, endpointURL string) Adapter

NewGenericOIDCAdapter creates an oAuth adapter out of the credentials and the baseURL

func NewGithubAdapter

func NewGithubAdapter(clientID, clientSecret, endpointURL string) Adapter

NewGithubAdapter creates an oAuth adapter out of the credentials and the baseURL

func NewGoogleAdapter

func NewGoogleAdapter(clientID, clientSecret string) Adapter

NewGoogleAdapter creates an oAuth adapter out of the credentials and the baseURL

func NewMicrosoftAdapter

func NewMicrosoftAdapter(clientID, clientSecret string) Adapter

NewMicrosoftAdapter creates an oAuth adapter out of the credentials and the baseURL

func NewOktaAdapter

func NewOktaAdapter(clientID, clientSecret, endpointURL string) Adapter

NewOktaAdapter creates an oAuth adapter out of the credentials and the baseURL

type AdapterWrapper

type AdapterWrapper struct{ Adapter }

AdapterWrapper wraps an normal oAuth Adapter with some generic functions to be implemented directly by the gin router

func WithAdapterWrapper

func WithAdapterWrapper(a Adapter, h *gin.RouterGroup) *AdapterWrapper

WithAdapterWrapper creates an adapterWrapper out of the oAuth Adapter and an gin.RouterGroup

func (*AdapterWrapper) HandleCallback

func (a *AdapterWrapper) HandleCallback(c *gin.Context)

HandleCallback handles and validates the callback which is coming back from the oAuth request

func (*AdapterWrapper) HandleLogin

func (a *AdapterWrapper) HandleLogin(c *gin.Context)

HandleLogin handles the incoming http request for the oAuth process and redirects to the generated URL of the provider

type JWTClaims

type JWTClaims struct {
	jwt.StandardClaims
	OAuthProvider string
	OAuthID       string
	OAuthName     string
	OAuthPicture  string
}

JWTClaims are the data and general information which is stored in the JWT

Jump to

Keyboard shortcuts

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