auth

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Type     string          `json:"type"`
	Secret   string          `json:"secret"`
	Keycloak *KeycloakConfig `json:"keycloak,omitempty"`
}

AuthConfig contains authentication configuration

type AuthManager

type AuthManager struct {
	// contains filtered or unexported fields
}

AuthManager handles authentication with relay server

func NewAuthManager

func NewAuthManager(config *AuthConfig) (*AuthManager, error)

NewAuthManager creates a new authentication manager

func (*AuthManager) CreateAuthMessage

func (am *AuthManager) CreateAuthMessage(tokenString string) (map[string]interface{}, error)

CreateAuthMessage creates an authentication message for relay server

func (*AuthManager) ExtractSubject

func (am *AuthManager) ExtractSubject(token *jwt.Token) (string, error)

ExtractSubject extracts subject from token

func (*AuthManager) GetTokenFromHeader

func (am *AuthManager) GetTokenFromHeader(header string) (string, error)

GetTokenFromHeader extracts token from Authorization header

func (*AuthManager) ValidateToken

func (am *AuthManager) ValidateToken(tokenString string) (*jwt.Token, error)

ValidateToken validates a JWT token

type JWK

type JWK struct {
	Kid string `json:"kid"`
	Kty string `json:"kty"`
	Alg string `json:"alg"`
	Use string `json:"use"`
	N   string `json:"n"`
	E   string `json:"e"`
}

JWK represents a JSON Web Key

type JWKS

type JWKS struct {
	Keys []JWK `json:"keys"`
}

JWKS represents JSON Web Key Set

type KeycloakConfig

type KeycloakConfig struct {
	ServerURL string `json:"server_url"`
	Realm     string `json:"realm"`
	ClientID  string `json:"client_id"`
	JWKSURL   string `json:"jwks_url"`
}

KeycloakConfig contains Keycloak-specific configuration

Jump to

Keyboard shortcuts

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