auth

package
v0.0.87 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAuthentication

func CheckAuthentication() gin.HandlerFunc

func IsAuthenticated

func IsAuthenticated() gin.HandlerFunc

Types

type Authenticator

type Authenticator interface {
	Authentiicate(*gin.Context) (SecurityToken, error)
}

type JwtAuthenticator

type JwtAuthenticator struct {
}

func NewJwtAuthenticator

func NewJwtAuthenticator() JwtAuthenticator

func (JwtAuthenticator) Authentiicate

func (a JwtAuthenticator) Authentiicate(c *gin.Context) (SecurityToken, error)

type SecurityToken

type SecurityToken interface {
	IsAuthenticated() bool
	GetOrganisation() string
	GetRawToken() string
}

type Token

type Token struct {
	RawToken      string
	Username      string `json:"username"`
	Organisation  string `json:"organisation"`
	Authenticated bool
}

func GetJwtToken

func GetJwtToken(c *gin.Context) (Token, error)

func NewToken

func NewToken() Token

func (Token) GetOrganisation

func (t Token) GetOrganisation() string

func (Token) GetRawToken

func (t Token) GetRawToken() string

func (Token) GetUsername

func (t Token) GetUsername() string

func (Token) IsAuthenticated

func (t Token) IsAuthenticated() bool

Jump to

Keyboard shortcuts

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