data

package
v0.0.0-...-0cec475 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const KeycloakPath = "http://keycloak"
View Source
const MicroserviceUserPath = "http://microservice-user:9090"

Variables

View Source
var ErrorEnvVar = fmt.Errorf("missing environment variable")

ErrorEnvVar : Environment variable error

Functions

func AddNewUser

func AddNewUser(user User)

func AddValueToList

func AddValueToList(values []byte, newKey string, newValue string) []byte

func ExtractClaims

func ExtractClaims(tokenString string) jwt.MapClaims

Extract a specific claim for the jwt token

func GetAdminAccessToken

func GetAdminAccessToken() string

func GetUser

func GetUser(userId string) []byte

func SetUserPassword

func SetUserPassword(path string, password string, admin_token string)

func SignInRequest

func SignInRequest(credentials Credentials) []byte

func SignUpRequest

func SignUpRequest(user User, admin_token string) string

Types

type Credentials

type Credentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type KeycloakUser

type KeycloakUser struct {
	Username  string `json:"username"`
	Email     string `json:"email"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Enabled   bool   `json:"enabled"`
}

func UserToKeycloakUser

func UserToKeycloakUser(user User) KeycloakUser

type TokenResponse

type TokenResponse struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int    `json:"expires_in"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
	RefreshToken     string `json:"refresh_token"`
	TokenType        string `json:"token_type"`
	NotBeforePolicy  int    `json:"not-before-policy"`
	SessionState     string `json:"session_state"`
	Scope            string `json:"scope"`
}

func GetAccessToken

func GetAccessToken(credentials Credentials) TokenResponse

type User

type User struct {
	ID           string `json:"id" bson:"_id"`
	Username     string `json:"username"`
	Password     string `json:"password"`
	Email        string `json:"email"`
	FirstName    string `json:"firstname"`
	LastName     string `json:"lastname"`
	DateOfBirth  string `json:"dateofbirth"`
	Gender       string `json:"gender"`
	Address      string `json:"address"`
	Bio          string `json:"bio"`
	Achievements string `json:"achievements"`
}

Jump to

Keyboard shortcuts

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