goidentity

package module
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

goidentity

Standard interface to holding authenticated identities and their attributes.

To get the package, execute:

go get gopkg.in/jcmturner/goidentity.v3

To import this package, add the following line to your code:

import "gopkg.in/jcmturner/goidentity.v3"

Documentation

Index

Constants

View Source
const (
	CTXKey = "jcmturner/goidentity"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Authenticate() (Identity, bool, error)
	Mechanism() string // gives the name of the type of authentication mechanism
}

type Identity

type Identity interface {
	UserName() string
	SetUserName(s string)
	Domain() string
	SetDomain(s string)
	DisplayName() string
	SetDisplayName(s string)
	Human() bool
	SetHuman(b bool)
	AuthTime() time.Time
	SetAuthTime(t time.Time)
	AuthzAttributes() []string
	AddAuthzAttribute(a string)
	RemoveAuthzAttribute(a string)
	Authenticated() bool
	SetAuthenticated(b bool)
	Authorized(a string) bool
	SessionID() string
	Expired() bool
	Attributes() map[string]string
	SetAttribute(k string, v string)
	SetAttributes(map[string]string)
	RemoveAttribute(k string)
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

type User

type User struct {
	// contains filtered or unexported fields
}

func NewUser

func NewUser(username string) User

func (*User) AddAuthzAttribute

func (u *User) AddAuthzAttribute(a string)

func (*User) Attributes

func (u *User) Attributes() map[string]string

func (*User) AuthTime

func (u *User) AuthTime() time.Time

func (*User) Authenticated

func (u *User) Authenticated() bool

func (*User) Authorized

func (u *User) Authorized(a string) bool

func (*User) AuthzAttributes

func (u *User) AuthzAttributes() []string

func (*User) DisableAuthzAttribute

func (u *User) DisableAuthzAttribute(a string)

func (*User) DisplayName

func (u *User) DisplayName() string

func (*User) Domain

func (u *User) Domain() string

func (*User) EnableAuthzAttribute

func (u *User) EnableAuthzAttribute(a string)

func (*User) Expired

func (u *User) Expired() bool

func (*User) Human

func (u *User) Human() bool

func (*User) Marshal

func (u *User) Marshal() ([]byte, error)

func (*User) RemoveAttribute

func (u *User) RemoveAttribute(k string)

func (*User) RemoveAuthzAttribute

func (u *User) RemoveAuthzAttribute(a string)

func (*User) SessionID

func (u *User) SessionID() string

func (*User) SetAttribute

func (u *User) SetAttribute(k string, v string)

func (*User) SetAttributes

func (u *User) SetAttributes(a map[string]string)

func (*User) SetAuthTime

func (u *User) SetAuthTime(t time.Time)

func (*User) SetAuthenticated

func (u *User) SetAuthenticated(b bool)

func (*User) SetDisplayName

func (u *User) SetDisplayName(s string)

func (*User) SetDomain

func (u *User) SetDomain(s string)

func (*User) SetExpiry

func (u *User) SetExpiry(t time.Time)

func (*User) SetHuman

func (u *User) SetHuman(b bool)

func (*User) SetUserName

func (u *User) SetUserName(s string)

func (*User) Unmarshal

func (u *User) Unmarshal(b []byte) error

func (*User) UserName

func (u *User) UserName() string

Jump to

Keyboard shortcuts

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