identitymodels

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package implements models representing identity

Index

Constants

View Source
const (
	IdentityTypeUser    IdentityType = "User"
	IdentityTypeCluster IdentityType = "Cluster"
	IdentityTypeService IdentityType = "Service"

	IdentityProviderOidc   IdentityProvider = "OIDC"
	IdentityProviderApiKey IdentityProvider = "APIKEY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthInfo

type AuthInfo struct {
	AuthProvider   IdentityProvider `json:"authProvider,omitempty"`
	AuthProviderID string           `json:"authProviderId,omitempty"`
	ExpirationTime time.Time        `json:"expirationTime,omitempty"`
}

type ContexIdentityType

type ContexIdentityType string

Type used to set identity in context

const ContexIdentity ContexIdentityType = "ror-identity"

type Identity

type Identity struct {
	Auth            AuthInfo         `json:"auth,omitempty"`
	Type            IdentityType     `json:"type,omitempty"`
	User            *User            `json:"user,omitempty"`
	ClusterIdentity *ServiceIdentity `json:"clusterIdentity,omitempty"`
	ServiceIdentity *ServiceIdentity `json:"serviceIdentity,omitempty"`
}

Identity is a representation of the consumers identity kept in the context for authentication

func (*Identity) GetAuthInfo

func (identity *Identity) GetAuthInfo() AuthInfo

Function returns the auth info of the identity

func (*Identity) GetId

func (identity *Identity) GetId() string

Function returns the id of the identity.

User is represented by email, cluster by clusterid and service by service name

func (*Identity) IsCluster

func (identity *Identity) IsCluster() bool

Function returns true if identity is a cluster

func (*Identity) IsService

func (identity *Identity) IsService() bool

Function returns true if identity is a service

func (*Identity) IsUser

func (identity *Identity) IsUser() bool

Function returns true if identity is an user

func (Identity) ReturnGroupQuery

func (identity Identity) ReturnGroupQuery() (bson.A, error)

Function returns a bson.A containing the groups of an identity. To be used in filtering in mongodb.

type IdentityProvider

type IdentityProvider string

type IdentityType

type IdentityType string

Type to hold the identitytype eg. user, cluster,service...

type ServiceIdentity

type ServiceIdentity struct {
	Id string `json:"id"`
}

The type is a representation of a cluster or service identity. May be splited if needed.

type User

type User struct {
	Email           string   `json:"email"`
	IsEmailVerified bool     `json:"email_verified"`
	Name            string   `json:"name"`
	Groups          []string `json:"groups"`
	Audience        string   `json:"aud"`
	Issuer          string   `json:"iss"`
	ExpirationTime  int      `json:"exp"`
}

The type is a representation of a user identity.

The json fields corresponds with the values provided in an oidc token.

Jump to

Keyboard shortcuts

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