Documentation ¶
Index ¶
- func DigitalWalletIsAuthorized(scope string, scopePrefix string, ...) (authorized bool)
- func InitModels()
- func IsValidLabel(label string) (valid bool)
- func LabelledPropertyIsAuthorized(scope string, scopePrefix string, authorizedLabels []AuthorizationMap) (authorized bool)
- func OwnerOfIsAuthorized(scope string, scopePrefix string, authorizedOwnerOfs []string) bool
- func ValidateEmailAddress(emailAddress string) bool
- func ValidateName(name string) bool
- func ValidatePhoneNumber(phoneNumber string) bool
- func ValidateUsername(username string) bool
- type Address
- type Authorization
- type AuthorizationMap
- type Avatar
- type BankAccount
- type ContractSigningRequest
- type DigitalAssetAddress
- type DigitalWalletAuthorization
- type EmailAddress
- type FBInfo
- type FacebookAccount
- type FacebookDataPic
- type FacebookError
- type FacebookPic
- type GithubAccount
- type JoinOrganizationRequest
- type Label
- type Manager
- func (m *Manager) AvatarFileExists(hash string) (bool, error)
- func (m *Manager) Delete(u *User) error
- func (m *Manager) DeleteAllAuthorizations(organization string) (err error)
- func (m *Manager) DeleteAuthorization(username, organization string) (err error)
- func (m *Manager) DeleteFacebookAccount(username string) (err error)
- func (m *Manager) DeleteGithubAccount(username string) (err error)
- func (m *Manager) Exists(username string) (bool, error)
- func (m *Manager) FilterUsersWithAuthorizations(usernames []string, organization string) ([]string, error)
- func (m *Manager) Get(id string) (*User, error)
- func (m *Manager) GetAuthorization(username, organization string) (authorization *Authorization, err error)
- func (m *Manager) GetAuthorizationsByUser(username string) (authorizations []Authorization, err error)
- func (m *Manager) GetAvatarFile(hash string) ([]byte, error)
- func (m *Manager) GetByEmailAddress(email string) (users []string, err error)
- func (m *Manager) GetByName(username string) (*User, error)
- func (m *Manager) GetOrganizationAuthorizations(globalId string) (authorizations []Authorization, err error)
- func (m *Manager) GetPendingRegistrationsCount() (int, error)
- func (m *Manager) RemoveAddress(username, label string) error
- func (m *Manager) RemoveAvatar(username, label string) error
- func (m *Manager) RemoveAvatarFile(hash string) error
- func (m *Manager) RemoveBank(u *User, label string) error
- func (m *Manager) RemoveEmail(username string, label string) error
- func (m *Manager) RemoveExpireDate(username string) (err error)
- func (m *Manager) RemovePhone(username string, label string) error
- func (m *Manager) RemovePublicKey(username string, label string) error
- func (m *Manager) RemoveVirtualCurrency(username string, label string) error
- func (m *Manager) Save(u *User) error
- func (m *Manager) SaveAddress(username string, address Address) error
- func (m *Manager) SaveAvatar(username string, avatar Avatar) error
- func (m *Manager) SaveAvatarFile(hash string, file []byte) error
- func (m *Manager) SaveBank(u *User, bank BankAccount) error
- func (m *Manager) SaveEmail(username string, email EmailAddress) error
- func (m *Manager) SavePhone(username string, phonenumber Phonenumber) error
- func (m *Manager) SavePublicKey(username string, key PublicKey) error
- func (m *Manager) SaveVirtualCurrency(username string, currency DigitalAssetAddress) error
- func (m *Manager) UpdateAuthorization(authorization *Authorization) (err error)
- func (m *Manager) UpdateFacebookAccount(username string, facebookaccount FacebookAccount) (err error)
- func (m *Manager) UpdateGithubAccount(username string, githubaccount GithubAccount) (err error)
- func (m *Manager) UpdateName(username string, firstname string, lastname string) (err error)
- type OwnerOf
- type Phonenumber
- type PublicKey
- type User
- func (u *User) GetAddressByLabel(label string) (address Address, err error)
- func (u *User) GetAvatarByLabel(label string) (avatar Avatar, err error)
- func (u *User) GetBankAccountByLabel(label string) (bankaccount BankAccount, err error)
- func (u *User) GetDigitalAssetAddressByLabel(label string) (walletAddress DigitalAssetAddress, err error)
- func (u *User) GetEmailAddressByLabel(label string) (email EmailAddress, err error)
- func (u *User) GetPhonenumberByLabel(label string) (phonenumber Phonenumber, err error)
- func (u *User) GetPublicKeyByLabel(label string) (publicKey PublicKey, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DigitalWalletIsAuthorized ¶
func DigitalWalletIsAuthorized(scope string, scopePrefix string, authorizedLabels []DigitalWalletAuthorization) (authorized bool)
DigitalWalletIsAuthorized checks if a digital wallet is authorized
func IsValidLabel ¶ added in v0.9.9
func LabelledPropertyIsAuthorized ¶
func LabelledPropertyIsAuthorized(scope string, scopePrefix string, authorizedLabels []AuthorizationMap) (authorized bool)
LabelledPropertyIsAuthorized checks if a labelled property is authorized
func OwnerOfIsAuthorized ¶ added in v0.9.8
func ValidateEmailAddress ¶
func ValidateName ¶ added in v0.9.15
func ValidatePhoneNumber ¶
func ValidateUsername ¶
Types ¶
type Address ¶
type Address struct { City string `json:"city" validate:"max=30"` Country string `json:"country" validate:"max=40"` Nr string `json:"nr" validate:"max=10"` Other string `json:"other" validate:"max=30"` Postalcode string `json:"postalcode" validate:"max=20"` Street string `json:"street" validate:"max=50"` Label string `json:"label" validate:"regexp=^[a-zA-Z\d\-_\s]{2,50}$"` }
type Authorization ¶
type Authorization struct { Addresses []AuthorizationMap `json:"addresses,omitempty"` BankAccounts []AuthorizationMap `json:"bankaccounts,omitempty"` DigitalWallet []DigitalWalletAuthorization `json:"digitalwallet,omitempty"` EmailAddresses []AuthorizationMap `json:"emailaddresses,omitempty"` ValidatedEmailAddresses []AuthorizationMap `json:"validatedemailaddresses,omitempty"` Facebook bool `json:"facebook,omitempty"` Github bool `json:"github,omitempty"` GrantedTo string `json:"grantedTo"` Organizations []string `json:"organizations"` Phonenumbers []AuthorizationMap `json:"phonenumbers,omitempty"` ValidatedPhonenumbers []AuthorizationMap `json:"validatedphonenumbers,omitempty"` PublicKeys []AuthorizationMap `json:"publicKeys,omitempty"` Username string `json:"username"` Name bool `json:"name"` OwnerOf OwnerOf `json:"ownerof,omitempty"` Avatars []AuthorizationMap `json:"avatars,omitempty"` KeyStore bool `json:"keystore,omitempty"` See bool `json:"see,omitempty"` }
Authorization defines what userinformation is authorized to be seen by an organization For an explanation about scopes and scopemapping, see https://github.com/itsyouonline/identityserver/blob/master/docs/oauth2/scopes.md
func (Authorization) ContainsOrganization ¶
func (authorization Authorization) ContainsOrganization(globalid string) bool
func (Authorization) FilterAuthorizedScopes ¶
func (authorization Authorization) FilterAuthorizedScopes(requestedscopes []string) (authorizedScopes []string)
FilterAuthorizedScopes filters the requested scopes to the ones this Authorization covers
func (*Authorization) Merge ¶ added in v0.9.15
func (auth *Authorization) Merge(a *Authorization)
Merge merges 2 authorizations.
type AuthorizationMap ¶
type Avatar ¶ added in v0.9.14
Avatar represents an avatar for a user. It is identified by a label, and stirng contains a link to the source
type BankAccount ¶
type BankAccount struct { Bic string `json:"bic"` Country string `json:"country"` Iban string `json:"iban"` Label string `json:"label" validate:"regexp=^[a-zA-Z\d\-_\s]{2,50}$"` }
func (BankAccount) Validate ¶ added in v0.9.9
func (bank BankAccount) Validate() bool
type ContractSigningRequest ¶
type DigitalAssetAddress ¶
type DigitalAssetAddress struct { CurrencySymbol string `json:"currencysymbol"` Address string `json:"address"` Label string `json:"label" validate:"regexp=^[a-zA-Z\d\-_\s]{2,50}$"` Expire db.DateTime `json:"expire"` Noexpiration bool `json:"noexpiration"` }
func (DigitalAssetAddress) Validate ¶ added in v0.9.9
func (d DigitalAssetAddress) Validate() bool
type DigitalWalletAuthorization ¶
type DigitalWalletAuthorization struct { AuthorizationMap Currency string `json:"currency"` }
type EmailAddress ¶
type EmailAddress struct { EmailAddress string `json:"emailaddress" validate:"max=100"` Label string `json:"label" validate:"regexp=^[a-zA-Z\d\-_\s]{2,50}$"` }
func (EmailAddress) Validate ¶ added in v0.9.9
func (e EmailAddress) Validate() bool
type FacebookAccount ¶
type FacebookDataPic ¶
type FacebookDataPic struct {
Data FacebookPic
}
type FacebookError ¶
type FacebookPic ¶
type GithubAccount ¶
type JoinOrganizationRequest ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is used to store users
func NewManager ¶
NewManager creates and initializes a new Manager
func (*Manager) AvatarFileExists ¶ added in v0.9.14
AvatarFileExists checks if an avatarfile with a given hash already exists
func (*Manager) DeleteAllAuthorizations ¶
DeleteAllAuthorizations removes all authorizations from an organization
func (*Manager) DeleteAuthorization ¶
DeleteAuthorization removes an authorization
func (*Manager) DeleteFacebookAccount ¶
func (*Manager) DeleteGithubAccount ¶
func (*Manager) FilterUsersWithAuthorizations ¶ added in v1.0.0
func (m *Manager) FilterUsersWithAuthorizations(usernames []string, organization string) ([]string, error)
FilterUsersWithAuthorizations returns the authorizations granted to an organization
func (*Manager) GetAuthorization ¶
func (m *Manager) GetAuthorization(username, organization string) (authorization *Authorization, err error)
GetAuthorization returns the authorization for a specific organization, nil if no such authorization exists
func (*Manager) GetAuthorizationsByUser ¶
func (m *Manager) GetAuthorizationsByUser(username string) (authorizations []Authorization, err error)
GetAuthorizationsByUser returns all authorizations for a specific user
func (*Manager) GetAvatarFile ¶ added in v0.9.14
GetAvatarFile gets the avatar file associated with a hash
func (*Manager) GetByEmailAddress ¶ added in v0.9.14
func (*Manager) GetOrganizationAuthorizations ¶
func (m *Manager) GetOrganizationAuthorizations(globalId string) (authorizations []Authorization, err error)
GetOrganizationAuthorizations returns all authorizations for a specific organization
func (*Manager) GetPendingRegistrationsCount ¶
func (*Manager) RemoveAddress ¶
RemoveAddress remove address associated with label
func (*Manager) RemoveAvatar ¶ added in v0.9.14
RemoveAvatar removes an avatar
func (*Manager) RemoveAvatarFile ¶ added in v0.9.14
RemoveAvatarFile removes an avatar file
func (*Manager) RemoveBank ¶
RemoveBank remove bank associated with label
func (*Manager) RemoveEmail ¶
RemoveEmail remove email associated with label
func (*Manager) RemoveExpireDate ¶
func (*Manager) RemovePhone ¶
RemovePhone remove phone associated with label
func (*Manager) RemovePublicKey ¶
RemovePublicKey remove public key associated with label
func (*Manager) RemoveVirtualCurrency ¶
RemoveVirtualCurrency remove phone associated with label
func (*Manager) SaveAddress ¶
SaveAddress save or update address
func (*Manager) SaveAvatar ¶ added in v0.9.14
SaveAvatar saves a new or updates an existing avatar
func (*Manager) SaveAvatarFile ¶ added in v0.9.14
SaveAvatarFile saves a new avatar file
func (*Manager) SaveBank ¶
func (m *Manager) SaveBank(u *User, bank BankAccount) error
SaveBank save or update bank account
func (*Manager) SaveEmail ¶
func (m *Manager) SaveEmail(username string, email EmailAddress) error
SaveEmail save or update email along with its label
func (*Manager) SavePhone ¶
func (m *Manager) SavePhone(username string, phonenumber Phonenumber) error
SavePhone save or update phone along with its label
func (*Manager) SavePublicKey ¶
SavePublicKey save or update public key along with its label
func (*Manager) SaveVirtualCurrency ¶
func (m *Manager) SaveVirtualCurrency(username string, currency DigitalAssetAddress) error
SaveVirtualCurrency save or update virtualcurrency along with its label
func (*Manager) UpdateAuthorization ¶
func (m *Manager) UpdateAuthorization(authorization *Authorization) (err error)
UpdateAuthorization inserts or updates an authorization
func (*Manager) UpdateFacebookAccount ¶
func (m *Manager) UpdateFacebookAccount(username string, facebookaccount FacebookAccount) (err error)
func (*Manager) UpdateGithubAccount ¶
func (m *Manager) UpdateGithubAccount(username string, githubaccount GithubAccount) (err error)
type OwnerOf ¶ added in v0.9.8
type OwnerOf struct {
EmailAddresses []string `json:"emailaddresses"`
}
type Phonenumber ¶
type Phonenumber struct { Label string `json:"label" validate:"regexp=^[a-zA-Z\d\-_\s]{2,50}$"` Phonenumber string `json:"phonenumber" validate:"regexp=\+[0-9]{6,50}$"` }
Phonenumber defines a phonenumber and has functions for validation
func (Phonenumber) Validate ¶ added in v0.9.9
func (p Phonenumber) Validate() bool
Validate checks if a phone number is in a valid format
type PublicKey ¶
type User ¶
type User struct { ID bson.ObjectId `json:"-" bson:"_id,omitempty"` Addresses []Address `json:"addresses"` BankAccounts []BankAccount `json:"bankaccounts"` EmailAddresses []EmailAddress `json:"emailaddresses"` Expire db.DateTime `json:"-" bson:"expire,omitempty"` Facebook FacebookAccount `json:"facebook"` Github GithubAccount `json:"github"` Phonenumbers []Phonenumber `json:"phonenumbers"` DigitalWallet []DigitalAssetAddress `json:"digitalwallet"` PublicKeys []PublicKey `json:"publicKeys"` Username string `json:"username" validate:"min=2,max=30,regexp=^[a-z0-9]{2,30}$"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Avatars []Avatar `json:"avatars"` }
func (*User) GetAddressByLabel ¶
func (*User) GetAvatarByLabel ¶ added in v0.9.14
GetAvatarByLabel gets the avatar associated with this label
func (*User) GetBankAccountByLabel ¶
func (u *User) GetBankAccountByLabel(label string) (bankaccount BankAccount, err error)
func (*User) GetDigitalAssetAddressByLabel ¶
func (u *User) GetDigitalAssetAddressByLabel(label string) (walletAddress DigitalAssetAddress, err error)
func (*User) GetEmailAddressByLabel ¶
func (u *User) GetEmailAddressByLabel(label string) (email EmailAddress, err error)
func (*User) GetPhonenumberByLabel ¶
func (u *User) GetPhonenumberByLabel(label string) (phonenumber Phonenumber, err error)