ldap

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTClaimsJSON

type JWTClaimsJSON struct {
	Iat      int      `json:"iat"`
	UID      string   `json:"uid"`
	Username string   `json:"username"`
	Expiry   int      `json:"exp"`
	Groups   []string `json:"groups"`
	Issuer   string   `json:"iss,omitempty"`
}

JWTClaimsJSON is used for decoding an incoming JSON JWT payload to the /authenticate API

func (*JWTClaimsJSON) Valid

func (c *JWTClaimsJSON) Valid() error

Valid so that JWTClaimsJSON satisfies the jwt.Claims interface

type Request

type Request struct {
	APIVersion string `json:"apiVersion,omitempty"`
	Kind       string `json:"kind,omitempty"`
	Spec       *Spec  `json:"spec,omitempty"`
}

Request maps the incoming auth request from api-server

type Spec

type Spec struct {
	Token string `json:"token,omitempty"`
}

Spec maps to the bearer token send by api-server

type Status

type Status struct {
	Authenticated *bool `json:"authenticated,omitempty"`
	User          *User `json:"user,omitempty"`
}

Status indicates if user is authenticated or not

type Token

type Token struct {
	JWT    string    `json:"token,omitempty"`
	Expiry time.Time `json:"expiry,omitempty"`
}

Token return JWT with its expiry time

func GenerateToken

func GenerateToken(user User, authConfig config.AuthConfig) (Token, error)

GenerateToken generates JWT

type User

type User struct {
	Username string   `json:"username,omitempty"`
	UID      string   `json:"uid,omitempty"`
	Groups   []string `json:"groups,omitempty"`
}

User holds user information from AD

func ValidateUser

func ValidateUser(req *http.Request, authConfig config.AuthConfig) (User, error)

ValidateUser validates user by extracting creds from the request body, then

authenticating against an ID backend and filling out the User struct from there.

type UserCredentials

type UserCredentials struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

UserCredentials holds user creds

type UserInfo

type UserInfo struct {
	APIVersion string  `json:"apiVersion,omitempty"`
	Kind       string  `json:"kind,omitempty"`
	Status     *Status `json:"status,omitempty"`
}

UserInfo holds authenticatoin information

func ValidateToken

func ValidateToken(token string) (UserInfo, error)

ValidateToken validates JWT token provided by user and fills out the UserInfo structure from the data within

Jump to

Keyboard shortcuts

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