security

package
v0.0.0-...-126b7d3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTokenUsername

func GetTokenUsername(c *fiber.Ctx) string

Types

type KeycloakAdminRealmUser

type KeycloakAdminRealmUser struct {
	Username string
	Password string
}

type KeycloakConfig

type KeycloakConfig struct {
	Keycloak       *gocloak.GoCloak
	Realm          string
	ClientID       string
	ClientSecret   string
	AdminRealmUser *KeycloakAdminRealmUser
	Enabled        bool
}

func (KeycloakConfig) CreateUser

func (kc KeycloakConfig) CreateUser(c *fiber.Ctx, simpleUser KeycloakSimpleUser) error

func (KeycloakConfig) Secure

func (kc KeycloakConfig) Secure(roles ...string) fiber.Handler

type KeycloakSimpleUser

type KeycloakSimpleUser struct {
	Username  string
	Password  string
	FirstName string
	LastName  string
	Email     string
}

type Securizer

type Securizer interface {
	Secure(roles ...string) fiber.Handler
}

type TokenClaims

type TokenClaims struct {
	Permission TokenPermission `json:"permission"`
	Audience   string          `json:"aud"`
	jwt.RegisteredClaims
}

type TokenConfig

type TokenConfig struct {
	SecretKey []byte
	Issuer    string
	Enabled   bool
}

func (TokenConfig) Secure

func (t TokenConfig) Secure(roles ...string) fiber.Handler

Secure method with role validation. If no role is specified no role validation is executed

type TokenPermission

type TokenPermission struct {
	Name  string   `json:"name"`
	Roles []string `json:"roles"`
}

Jump to

Keyboard shortcuts

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