Documentation ¶
Index ¶
- Variables
- func GetAdminToken(ctx context.Context, username string, password string, realm string) (*gocloak.JWT, error)
- func GetToken(ctx context.Context, username string, password string, clientId string, ...) (*gocloak.JWT, error)
- func InitKeycloak(ctx context.Context, username string, password string, realm string, ...) error
- func RefreshToken(ctx context.Context, refreshToken string, realm string, clientID string) (*gocloak.JWT, error)
- func UpdateAttributesUser(ctx context.Context, email string, realm string, ...) (bool, error)
- func ValidateStruct(request LoginRequest) *utils.ApiError
- type AuthHandler
- type AuthResponse
- type AuthService
- type AuthStore
- type GoCloakAuthStore
- type KeycloakMutexWrapper
- type LoginRequest
- type LogoutRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var AdminJWT *gocloak.JWT
View Source
var Certificates jose.JSONWebKeySet
View Source
var Client string
View Source
var ClientID string
View Source
var ClientSecret string
View Source
var Realm *string
View Source
var RealmManagementClientId string
View Source
var Server string
Functions ¶
func GetAdminToken ¶
func InitKeycloak ¶
func InitKeycloak(ctx context.Context, username string, password string, realm string, server string) error
Init Keycloak one time
func RefreshToken ¶
func RefreshToken(ctx context.Context, refreshToken string, realm string, clientID string) (*gocloak.JWT, error)
refresh
func UpdateAttributesUser ¶
func ValidateStruct ¶
func ValidateStruct(request LoginRequest) *utils.ApiError
Types ¶
type AuthHandler ¶
type AuthHandler struct {
Service *AuthService
}
func (*AuthHandler) Login ¶
func (h *AuthHandler) Login(c *fiber.Ctx) error
Login godoc @Summary Login @Description Login @Tags keycloak @Accept json @Param request body LoginRequest true "request" @Produce json @Success 200 {object} AuthResponse @Router /auth/login [post]
type AuthResponse ¶
type AuthResponse struct {
Token string `json:"token"`
}
type AuthService ¶
type AuthService struct { }
func (*AuthService) Login ¶
func (s *AuthService) Login(username string, password string) (*AuthResponse, error)
type GoCloakAuthStore ¶
func (*GoCloakAuthStore) Login ¶
func (s *GoCloakAuthStore) Login(username string, password string)
type KeycloakMutexWrapper ¶
keycloak Mutex Wrapper to prevent leak memory and problem with concurrent access
var GCloakClient KeycloakMutexWrapper
type LoginRequest ¶
type LogoutRequest ¶
type LogoutRequest struct {
RefreshToken string `json:"refresh_token"`
}
Click to show internal directories.
Click to hide internal directories.