prime

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Name             string `hsk:"size(30)"`
	Secret           string
	Url              string `hsk:"size(128)"`
	AllowedResources []string
	TermsEnabled     bool
	CodesEnabled     bool
}

func NewClient added in v1.0.26

func NewClient(name, secret, url string, terms, codes bool, resources []string) Client

func (Client) ResourceAllowed

func (c Client) ResourceAllowed(resource string) bool

func (Client) Valid

func (c Client) Valid() error

func (Client) VerifySecret

func (c Client) VerifySecret(secret string) bool

type ClientQuery added in v1.0.8

type ClientQuery struct {
	Username string
	Consent  map[string][]string
}

ClientQuery is the response from QueryRequest

type Contact

type Contact struct {
	Icon  string `hsk:"size(15)"`
	Name  string `hsk:"size(20)"`
	Value string `hsk:"size(256)"`
}

Contact holds information like email, facebook, cellphone

func (Contact) Valid

func (c Contact) Valid() error

type Contacts

type Contacts []Contact

func (Contacts) ProvideClaim

func (c Contacts) ProvideClaim(claim string) (string, error)

type LoginRequest added in v1.0.2

type LoginRequest struct {
	Client   string
	Username string
	Password string
}

type Profile

type Profile struct {
	Title       string `hsk:"size(128)"`
	Description string `hsk:"size(512)" json:",omitempty"`
	Contacts    Contacts
	ImageKey    hsk.Key `hsk:"null"`
	Clients     []Client
	Endpoints   dict.Map
	Codes       dict.Map
	Terms       dict.Map
}

func (Profile) GetClient

func (p Profile) GetClient(id string) (Client, error)

func (Profile) GetClientClaims added in v1.5.3

func (p Profile) GetClientClaims(c Client) tokens.Claims

func (Profile) ProvideClaim

func (p Profile) ProvideClaim(claim string) (interface{}, error)

func (Profile) Valid

func (p Profile) Valid() error

type QueryRequest added in v1.0.8

type QueryRequest struct {
	Token  string
	Claims interface{}
}

func (QueryRequest) GetRequirements added in v1.5.9

func (q QueryRequest) GetRequirements() (map[string]bool, error)

type Resource

type Resource struct {
	Name        string `hsk:"size(25)"`
	DisplayName string `hsk:"size(50)"`
	Secret      string
	Needs       []string
}

func NewResource added in v1.0.26

func NewResource(name, displayName, secret string, needs []string) Resource

func (Resource) Valid added in v1.0.5

func (r Resource) Valid() error

func (Resource) VerifySecret

func (r Resource) VerifySecret(secret string) bool

type Role added in v1.5.9

type Role struct {
	ProfileID string
	Role      roletype.Enum
}

type User

type User struct {
	Name      string `hsk:"size(75)"`
	Verified  bool   `hsk:"default(false)"`
	Email     string `hsk:"size(128)"`
	Password  string `hsk:"min(6)"`
	Contacts  Contacts
	Resources []string
	Roles     []Role
}

func (User) ClientRole added in v1.5.9

func (u User) ClientRole(profileID string) roletype.Enum

func (User) GetEmail

func (u User) GetEmail() string

func (User) GetName

func (u User) GetName() string

func (User) IsVerified

func (u User) IsVerified() bool

func (User) ProvideClaim

func (u User) ProvideClaim(claim string) (string, error)

func (User) ResourceAllowed added in v1.0.6

func (u User) ResourceAllowed(name string) bool

func (User) Valid added in v1.0.2

func (u User) Valid() error

func (User) VerifyPassword

func (u User) VerifyPassword(password string) bool

type Userer added in v1.0.2

type Userer interface {
	GetName() string
	GetEmail() string
	IsVerified() bool
	VerifyPassword(password string) bool
	ResourceAllowed(name string) bool
	ProvideClaim(claim string) (string, error)
}

func NewUser

func NewUser(name, email, password string, verified bool, contacts Contacts, resources []string) Userer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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