iam

package module
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

README

iam

Identity and Access Management for the Hanzo platform. OAuth 2.1, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, RADIUS — multi-tenant, white-label.

Status License

Quick start

docker run -p 8000:8000 ghcr.io/hanzoai/iam:latest

Open http://localhost:8000.

What this is

iam is the canonical identity provider for every Hanzo deployment. Serves SSO across hanzo.id, lux.id, zoo.id, pars.id, and any white-label domain a tenant configures. Issues JWTs that every other Hanzo subsystem trusts via a single JWKS endpoint.

Specs

Implements:

  • HIP-0026 IAM Standard (RFC 6749 / OIDC compliant endpoints)
  • HIP-0106 Unified Cloud Binary (iam subsystem)

Architecture

   user / app  ->  hanzo.id / {tenant}.id  ->  iam (zip.App)
                                                  |
                                          OAuth2/OIDC/SAML
                                          users, orgs, apps, roles
                                                  |
                                       JWT signed with per-tenant key
                                                  |
                              every other Hanzo subsystem trusts via JWKS
                              (gateway strips client-supplied identity
                              headers, mints validated ones from the JWT)

Hanzo IAM

An open-source AI-first Identity and Access Management (IAM) /AI MCP gateway and auth server with web UI supporting MCP, A2A, OAuth 2.1, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, Google Workspace, Azure AD

Identity and Access Management for the Hanzo ecosystem.
UI-first centralized authentication / Single-Sign-On (SSO) platform supporting OAuth 2.0, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, and RADIUS.

Build GitHub Release Docker Pulls Go Report Card License


Features

  • OAuth 2.0 / OIDC provider -- standards-compliant identity provider with full authorization code, implicit, client-credentials, and device-code flows
  • SAML / CAS / LDAP -- enterprise federation and directory integration
  • WebAuthn / Passkeys -- passwordless authentication with FIDO2 hardware keys and platform authenticators
  • TOTP / MFA -- time-based one-time passwords and multi-factor authentication
  • Social login -- 40+ identity providers (GitHub, Google, Apple, Microsoft, Discord, and more)
  • RBAC -- role-based access control with fine-grained permissions
  • Multi-tenancy -- multiple organizations and applications in a single deployment
  • API-first -- full REST API for programmatic user, application, and organization management
  • SCIM provisioning -- automated user lifecycle management
  • RADIUS -- network access authentication

Quick Start

Docker
docker run -d \
  --name hanzo-iam \
  -p 8000:8000 \
  hanzoai/iam:latest

Open http://localhost:8000 in your browser.

Docker Compose
# compose.yml
services:
  iam:
    image: hanzoai/iam:latest
    ports:
      - "8000:8000"
    volumes:
      - iam-data:/var/lib/iam
    restart: unless-stopped

volumes:
  iam-data:
docker compose up -d
From Source
git clone https://github.com/hanzoai/iam.git
cd iam
go build ./...

Domains

Hanzo IAM serves SSO across multiple organizations via white-label domain support:

Domain Purpose
hanzo.id Hanzo AI accounts

Additional domains can be configured per organization. Each domain gets its own branding, login flow, and user pool while sharing the same IAM infrastructure.

Documentation

Full documentation is available at docs.hanzo.ai.

Operator quick-links:

The CLI, TS SDK, and Liquidity's liquid iam wrapper all call the same REST surface; pick the layer that fits your tool.

License

Apache-2.0 — historical attribution and third-party notices in NOTICE.

Copyright 2025-2026 Hanzo AI Inc

Documentation

Index

Constants

View Source
const (
	EMAIL string = "email"
	SMS   string = "sms"
	APP   string = "app"
)
View Source
const MfaRecoveryCodesSession = "mfa_recovery_codes"

Variables

View Source
var (
	ErrTokenMissing  = errors.New("iam: authentication required")
	ErrTokenInvalid  = errors.New("iam: invalid token")
	ErrTokenExpired  = errors.New("iam: token expired")
	ErrTokenRevoked  = errors.New("iam: token revoked")
	ErrTokenAudience = errors.New("iam: token audience mismatch")
	ErrUserNotFound  = errors.New("iam: user not found")
	ErrOrgNotFound   = errors.New("iam: org not found")
	ErrCrossOrg      = errors.New("iam: cross-org access forbidden")
)

Typed errors. Callers branch via errors.Is.

Identity input model: every method that takes a string identifier (userID, orgID, roleName, perm) operates within the actor scope derived from the caller's validated bearer-auth Claims. Cross-org reads return ErrCrossOrg, not ErrUserNotFound — the latter would allow an attacker to enumerate users in other orgs.

View Source
var (
	CasdoorApplication  = "app-built-in"
	CasdoorOrganization = "built-in"
)
View Source
var (
	TestCasdoorEndpoint     = "https://demo.hanzo-iam.com"
	TestClientId            = "294b09fbc17f95daf2fe"
	TestClientSecret        = "dd8982f7046ccba1bbd7851d5c1ece4e52bf039d"
	TestCasdoorOrganization = "casbin"
	TestCasdoorApplication  = "app-vue-python-example"
)
View Source
var TestJwtPublicKey = `` /* 1784-byte string literal not displayed */

Functions

func AddAdapter

func AddAdapter(adapter *Adapter) (bool, error)

func AddApplication

func AddApplication(application *Application) (bool, error)

func AddCert

func AddCert(cert *Cert) (bool, error)

func AddEnforcer

func AddEnforcer(enforcer *Enforcer) (bool, error)

func AddGroup

func AddGroup(group *Group) (bool, error)

func AddInvitation

func AddInvitation(invitation *Invitation) (bool, error)

func AddLdap

func AddLdap(Ldap *Ldap) (bool, error)

func AddModel

func AddModel(model *Model) (bool, error)

func AddOrder

func AddOrder(order *Order) (bool, error)

func AddOrganization

func AddOrganization(organization *Organization) (bool, error)

func AddPayment

func AddPayment(payment *Payment) (bool, error)

func AddPermission

func AddPermission(permission *Permission) (bool, error)

func AddPlan

func AddPlan(plan *Plan) (bool, error)

func AddPolicy

func AddPolicy(enforcer *Enforcer, policy *CasbinRule) (bool, error)

func AddPricing

func AddPricing(pricing *Pricing) (bool, error)

func AddProduct

func AddProduct(product *Product) (bool, error)

func AddProvider

func AddProvider(provider *Provider) (bool, error)

func AddRecord

func AddRecord(record *Record) (bool, error)

func AddRole

func AddRole(role *Role) (bool, error)

func AddSession

func AddSession(session *Session) (bool, error)

func AddSubscription

func AddSubscription(subscription *Subscription) (bool, error)

func AddSyncer

func AddSyncer(syncer *Syncer) (bool, error)

func AddToken

func AddToken(token *Token) (bool, error)

func AddTransaction

func AddTransaction(transaction *Transaction) (bool, string, error)

func AddTransactionWithDryRun

func AddTransactionWithDryRun(transaction *Transaction, dryrun bool) (bool, string, error)

func AddUser

func AddUser(user *User) (bool, error)

func AddWebhook

func AddWebhook(webhook *Webhook) (bool, error)

func BatchEnforce

func BatchEnforce(permissionId string, modelId string, resourceId string, enforcerId string, owner string, casbinRequests []CasbinRequest) ([][]bool, error)

func CancelOrder

func CancelOrder(name string) (bool, error)

func CheckUserPassword

func CheckUserPassword(user *User) (bool, error)

func DeleteAdapter

func DeleteAdapter(adapter *Adapter) (bool, error)

func DeleteApplication

func DeleteApplication(application *Application) (bool, error)

func DeleteCert

func DeleteCert(cert *Cert) (bool, error)

func DeleteEnforcer

func DeleteEnforcer(enforcer *Enforcer) (bool, error)

func DeleteGroup

func DeleteGroup(group *Group) (bool, error)

func DeleteInvitation

func DeleteInvitation(invitation *Invitation) (bool, error)

func DeleteLdap

func DeleteLdap(Ldap *Ldap) (bool, error)

func DeleteModel

func DeleteModel(model *Model) (bool, error)

func DeleteOrder

func DeleteOrder(order *Order) (bool, error)

func DeleteOrganization

func DeleteOrganization(organization *Organization) (bool, error)

func DeletePayment

func DeletePayment(payment *Payment) (bool, error)

func DeletePermission

func DeletePermission(permission *Permission) (bool, error)

func DeletePlan

func DeletePlan(plan *Plan) (bool, error)

func DeletePricing

func DeletePricing(pricing *Pricing) (bool, error)

func DeleteProduct

func DeleteProduct(product *Product) (bool, error)

func DeleteProvider

func DeleteProvider(provider *Provider) (bool, error)

func DeleteResource

func DeleteResource(resource *Resource) (bool, error)

func DeleteResourceWithTag

func DeleteResourceWithTag(resource *Resource, tag string) (bool, error)

func DeleteRole

func DeleteRole(role *Role) (bool, error)

func DeleteSession

func DeleteSession(session *Session) (bool, error)

func DeleteSubscription

func DeleteSubscription(subscription *Subscription) (bool, error)

func DeleteSyncer

func DeleteSyncer(syncer *Syncer) (bool, error)

func DeleteToken

func DeleteToken(token *Token) (bool, error)

func DeleteTransaction

func DeleteTransaction(transaction *Transaction) (bool, error)

func DeleteUser

func DeleteUser(user *User) (bool, error)

func DeleteWebhook

func DeleteWebhook(webhook *Webhook) (bool, error)

func DoGetBytes

func DoGetBytes(url string) ([]byte, error)

DoGetBytes is a general function to get response data in bytes from param url through HTTP Get method.

func DoGetBytesRaw

func DoGetBytesRaw(url string) ([]byte, error)

DoGetBytesRaw is a general function to get response from param url through HTTP Get method.

func DoPostBytesRaw

func DoPostBytesRaw(url string, contentType string, body io.Reader) ([]byte, error)

DoPostBytesRaw is a general function to post a request from url, body through HTTP Post method.

func Enforce

func Enforce(permissionId string, modelId string, resourceId string, enforcerId string, owner string, casbinRequest CasbinRequest) (bool, error)

func GetCurrentTime

func GetCurrentTime() string

func GetMyProfileUrl

func GetMyProfileUrl(accessToken string) string

func GetOAuthToken

func GetOAuthToken(code string, state string, opts ...OAuthOption) (*oauth2.Token, error)

func GetSigninUrl

func GetSigninUrl(redirectUri string) string

func GetSignupUrl

func GetSignupUrl(enablePassword bool, redirectUri string) string

func GetUrl

func GetUrl(action string, queryMap map[string]string) string

func GetUserCount

func GetUserCount(isOnline string) (int, error)

func GetUserProfileUrl

func GetUserProfileUrl(userName string, accessToken string) string

func InitConfig

func InitConfig(endpoint string, clientId string, clientSecret string, certificate string, organizationName string, applicationName string)

func InvoicePayment

func InvoicePayment(payment *Payment) (bool, error)

func NotifyPayment

func NotifyPayment(payment *Payment) (bool, error)

func RefreshOAuthToken

func RefreshOAuthToken(refreshToken string, opts ...OAuthOption) (*oauth2.Token, error)

func RemovePolicy

func RemovePolicy(enforcer *Enforcer, policy *CasbinRule) (bool, error)

func SendEmail

func SendEmail(title string, content string, sender string, receivers ...string) error

func SendEmailByProvider

func SendEmailByProvider(title string, content string, sender string, provider string, receivers ...string) error

func SendSms

func SendSms(content string, receivers ...string) error

func SendSmsByProvider

func SendSmsByProvider(content string, provider string, receivers ...string) error

func SetHttpClient

func SetHttpClient(httpClient HttpClient)

SetHttpClient sets custom http Client.

func SetPassword

func SetPassword(owner, name, oldPassword, newPassword string) (bool, error)

note: oldPassword is not required, if you don't need, just pass a empty string

func UpdateAdapter

func UpdateAdapter(adapter *Adapter) (bool, error)

func UpdateApplication

func UpdateApplication(application *Application) (bool, error)

func UpdateCert

func UpdateCert(cert *Cert) (bool, error)

func UpdateEnforcer

func UpdateEnforcer(enforcer *Enforcer) (bool, error)

func UpdateGroup

func UpdateGroup(group *Group) (bool, error)

func UpdateInvitation

func UpdateInvitation(invitation *Invitation) (bool, error)

func UpdateInvitationForColumns

func UpdateInvitationForColumns(invitation *Invitation, columns []string) (bool, error)

func UpdateLdap

func UpdateLdap(Ldap *Ldap) (bool, error)

func UpdateModel

func UpdateModel(model *Model) (bool, error)

func UpdateOrder

func UpdateOrder(order *Order) (bool, error)

func UpdateOrganization

func UpdateOrganization(organization *Organization) (bool, error)

func UpdatePayment

func UpdatePayment(payment *Payment) (bool, error)

func UpdatePermission

func UpdatePermission(permission *Permission) (bool, error)

func UpdatePermissionForColumns

func UpdatePermissionForColumns(permission *Permission, columns []string) (bool, error)

func UpdatePlan

func UpdatePlan(plan *Plan) (bool, error)

func UpdatePolicy

func UpdatePolicy(enforcer *Enforcer, oldpolicy *CasbinRule, newpolicy *CasbinRule) (bool, error)

func UpdatePricing

func UpdatePricing(pricing *Pricing) (bool, error)

func UpdateProduct

func UpdateProduct(product *Product) (bool, error)

func UpdateProvider

func UpdateProvider(provider *Provider) (bool, error)

func UpdateRole

func UpdateRole(role *Role) (bool, error)

func UpdateRoleForColumns

func UpdateRoleForColumns(role *Role, columns []string) (bool, error)

func UpdateSession

func UpdateSession(session *Session) (bool, error)

func UpdateSessionForColumns

func UpdateSessionForColumns(session *Session, columns []string) (bool, error)

func UpdateSubscription

func UpdateSubscription(subscription *Subscription) (bool, error)

func UpdateSyncer

func UpdateSyncer(syncer *Syncer) (bool, error)

func UpdateToken

func UpdateToken(token *Token) (bool, error)

func UpdateTokenForColumns

func UpdateTokenForColumns(token *Token, columns []string) (bool, error)

func UpdateTransaction

func UpdateTransaction(transaction *Transaction) (bool, error)

func UpdateUser

func UpdateUser(user *User) (bool, error)

func UpdateUserById

func UpdateUserById(id string, user *User) (bool, error)

func UpdateUserForColumns

func UpdateUserForColumns(user *User, columns []string) (bool, error)

func UpdateWebhook

func UpdateWebhook(webhook *Webhook) (bool, error)

func UploadResource

func UploadResource(user string, tag string, parent string, fullFilePath string, fileBytes []byte) (string, string, error)

func UploadResourceEx

func UploadResourceEx(user string, tag string, parent string, fullFilePath string, fileBytes []byte, createdTime string, description string) (string, string, error)

Types

type AccountItem

type AccountItem struct {
	Name       string `json:"name"`
	Visible    bool   `json:"visible"`
	ViewRule   string `json:"viewRule"`
	ModifyRule string `json:"modifyRule"`
	Regex      string `json:"regex"`
}

type Adapter

type Adapter struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	UseSameDb       bool   `json:"useSameDb"`
	Type            string `xorm:"varchar(100)" json:"type"`
	DatabaseType    string `xorm:"varchar(100)" json:"databaseType"`
	Host            string `xorm:"varchar(100)" json:"host"`
	Port            int    `json:"port"`
	User            string `xorm:"varchar(100)" json:"user"`
	Password        string `xorm:"varchar(100)" json:"password"`
	Database        string `xorm:"varchar(100)" json:"database"`
	Table           string `xorm:"varchar(100)" json:"table"`
	TableNamePrefix string `xorm:"varchar(100)" json:"tableNamePrefix"`

	IsEnabled bool `json:"isEnabled"`
}

func GetAdapter

func GetAdapter(name string) (*Adapter, error)

func GetAdapters

func GetAdapters() ([]*Adapter, error)

func GetPaginationAdapters

func GetPaginationAdapters(p int, pageSize int, queryMap map[string]string) ([]*Adapter, int, error)

type Address

type Address struct {
	Tag     string `xorm:"varchar(100)" json:"tag"`
	Line1   string `xorm:"varchar(100)" json:"line1"`
	Line2   string `xorm:"varchar(100)" json:"line2"`
	City    string `xorm:"varchar(100)" json:"city"`
	State   string `xorm:"varchar(100)" json:"state"`
	ZipCode string `xorm:"varchar(100)" json:"zipCode"`
	Region  string `xorm:"varchar(100)" json:"region"`
}

type Application

type Application struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	DisplayName                  string          `xorm:"varchar(100)" json:"displayName"`
	Title                        string          `xorm:"varchar(100)" json:"title"`
	Favicon                      string          `xorm:"varchar(200)" json:"favicon"`
	Order                        int             `json:"order"`
	HomepageUrl                  string          `xorm:"varchar(100)" json:"homepageUrl"`
	Description                  string          `xorm:"varchar(100)" json:"description"`
	Organization                 string          `xorm:"varchar(100)" json:"organization"`
	Cert                         string          `xorm:"varchar(100)" json:"cert"`
	DefaultGroup                 string          `xorm:"varchar(100)" json:"defaultGroup"`
	HeaderHtml                   string          `xorm:"mediumtext" json:"headerHtml"`
	EnablePassword               bool            `json:"enablePassword"`
	EnableSignUp                 bool            `json:"enableSignUp"`
	DisableSignin                bool            `json:"disableSignin"`
	EnableSigninSession          bool            `json:"enableSigninSession"`
	EnableAutoSignin             bool            `json:"enableAutoSignin"`
	EnableCodeSignin             bool            `json:"enableCodeSignin"`
	EnableExclusiveSignin        bool            `json:"enableExclusiveSignin"`
	EnableSamlCompress           bool            `json:"enableSamlCompress"`
	EnableSamlC14n10             bool            `json:"enableSamlC14n10"`
	EnableSamlPostBinding        bool            `json:"enableSamlPostBinding"`
	DisableSamlAttributes        bool            `json:"disableSamlAttributes"`
	EnableSamlAssertionSignature bool            `json:"enableSamlAssertionSignature"`
	UseEmailAsSamlNameId         bool            `json:"useEmailAsSamlNameId"`
	EnableWebAuthn               bool            `json:"enableWebAuthn"`
	EnableLinkWithEmail          bool            `json:"enableLinkWithEmail"`
	OrgChoiceMode                string          `json:"orgChoiceMode"`
	SamlReplyUrl                 string          `xorm:"varchar(500)" json:"samlReplyUrl"`
	Providers                    []*ProviderItem `xorm:"mediumtext" json:"providers"`
	SigninMethods                []*SigninMethod `xorm:"varchar(2000)" json:"signinMethods"`
	SignupItems                  []*SignupItem   `xorm:"varchar(3000)" json:"signupItems"`
	SigninItems                  []*SigninItem   `xorm:"mediumtext" json:"signinItems"`
	GrantTypes                   []string        `xorm:"varchar(1000)" json:"grantTypes"`
	OrganizationObj              *Organization   `xorm:"-" json:"organizationObj"`
	CertPublicKey                string          `xorm:"-" json:"certPublicKey"`
	Tags                         []string        `xorm:"mediumtext" json:"tags"`
	SamlAttributes               []*SamlItem     `xorm:"varchar(1000)" json:"samlAttributes"`
	SamlHashAlgorithm            string          `xorm:"varchar(20)" json:"samlHashAlgorithm"`
	IsShared                     bool            `json:"isShared"`
	IpRestriction                string          `json:"ipRestriction"`

	ClientId                string     `xorm:"varchar(100)" json:"clientId"`
	ClientSecret            string     `xorm:"varchar(100)" json:"clientSecret"`
	RedirectUris            []string   `xorm:"varchar(1000)" json:"redirectUris"`
	ForcedRedirectOrigin    string     `xorm:"varchar(100)" json:"forcedRedirectOrigin"`
	TokenFormat             string     `xorm:"varchar(100)" json:"tokenFormat"`
	TokenSigningMethod      string     `xorm:"varchar(100)" json:"tokenSigningMethod"`
	TokenFields             []string   `xorm:"varchar(1000)" json:"tokenFields"`
	TokenAttributes         []*JwtItem `xorm:"mediumtext" json:"tokenAttributes"`
	ExpireInHours           float64    `json:"expireInHours"`
	RefreshExpireInHours    float64    `json:"refreshExpireInHours"`
	CookieExpireInHours     int64      `json:"cookieExpireInHours"`
	SignupUrl               string     `xorm:"varchar(200)" json:"signupUrl"`
	SigninUrl               string     `xorm:"varchar(200)" json:"signinUrl"`
	ForgetUrl               string     `xorm:"varchar(200)" json:"forgetUrl"`
	AffiliationUrl          string     `xorm:"varchar(100)" json:"affiliationUrl"`
	IpWhitelist             string     `xorm:"varchar(200)" json:"ipWhitelist"`
	TermsOfUse              string     `xorm:"varchar(200)" json:"termsOfUse"`
	SignupHtml              string     `xorm:"mediumtext" json:"signupHtml"`
	SigninHtml              string     `xorm:"mediumtext" json:"signinHtml"`
	ThemeData               *ThemeData `xorm:"json" json:"themeData"`
	FooterHtml              string     `xorm:"mediumtext" json:"footerHtml"`
	FormCss                 string     `xorm:"text" json:"formCss"`
	FormCssMobile           string     `xorm:"text" json:"formCssMobile"`
	FormOffset              int        `json:"formOffset"`
	FormSideHtml            string     `xorm:"mediumtext" json:"formSideHtml"`
	FormBackgroundUrl       string     `xorm:"varchar(200)" json:"formBackgroundUrl"`
	FormBackgroundUrlMobile string     `xorm:"varchar(200)" json:"formBackgroundUrlMobile"`

	FailedSigninLimit      int `json:"failedSigninLimit"`
	FailedSigninFrozenTime int `json:"failedSigninFrozenTime"`
	CodeResendTimeout      int `json:"codeResendTimeout"`

	CertObj *Cert `xorm:"-" json:"certObj"`
}

Application has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/application.go#L61

func GetApplication

func GetApplication(name string) (*Application, error)

func GetApplications

func GetApplications() ([]*Application, error)

func GetOrganizationApplications

func GetOrganizationApplications() ([]*Application, error)

type AuthConfig

type AuthConfig struct {
	Endpoint         string
	ClientId         string
	ClientSecret     string
	Certificate      string
	OrganizationName string
	ApplicationName  string
}

AuthConfig is the core configuration. The first step to use this SDK is to use the InitConfig function to initialize the global authConfig.

type CasbinRequest

type CasbinRequest = []interface{}

type CasbinRule

type CasbinRule struct {
	Id    int64  `xorm:"pk autoincr"`
	Ptype string `xorm:"varchar(100) index not null default ''"`
	V0    string `xorm:"varchar(100) index not null default ''"`
	V1    string `xorm:"varchar(100) index not null default ''"`
	V2    string `xorm:"varchar(100) index not null default ''"`
	V3    string `xorm:"varchar(100) index not null default ''"`
	V4    string `xorm:"varchar(100) index not null default ''"`
	V5    string `xorm:"varchar(100) index not null default ''"`
	// contains filtered or unexported fields
}

func GetFilteredPolicies

func GetFilteredPolicies(enforcerId string, filters []*PolicyFilter) ([]*CasbinRule, error)

GetFilteredPolicies gets policies with filtering capabilities based on field index and values

func GetPolicies

func GetPolicies(enforcerName string, adapterId string) ([]*CasbinRule, error)

type Cert

type Cert struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	DisplayName     string `xorm:"varchar(100)" json:"displayName"`
	Scope           string `xorm:"varchar(100)" json:"scope"`
	Type            string `xorm:"varchar(100)" json:"type"`
	CryptoAlgorithm string `xorm:"varchar(100)" json:"cryptoAlgorithm"`
	BitSize         int    `json:"bitSize"`
	ExpireInYears   int    `json:"expireInYears"`

	Certificate            string `xorm:"mediumtext" json:"certificate"`
	PrivateKey             string `xorm:"mediumtext" json:"privateKey"`
	AuthorityPublicKey     string `xorm:"mediumtext" json:"authorityPublicKey"`
	AuthorityRootPublicKey string `xorm:"mediumtext" json:"authorityRootPublicKey"`
}

Cert has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/cert.go#L24

func GetCert

func GetCert(name string) (*Cert, error)

func GetCerts

func GetCerts() ([]*Cert, error)

func GetGlobalCerts

func GetGlobalCerts() ([]*Cert, error)

type Claims

type Claims struct {
	User
	AccessToken string `json:"accessToken"`
	jwt.RegisteredClaims
	TokenType        string `json:"tokenType"`
	RefreshTokenType string `json:"TokenType"`
	SigninMethod     string `json:"signinMethod"`
}

func ParseJwtToken

func ParseJwtToken(token string) (*Claims, error)

func (Claims) IsRefreshToken

func (c Claims) IsRefreshToken() bool

IsRefreshToken returns true if the token is a refresh token

type Client

type Client struct {
	AuthConfig
	CustomHeaders map[string]string
}

func NewClient

func NewClient(endpoint string, clientId string, clientSecret string, certificate string, organizationName string, applicationName string) *Client

func NewClientWithConf

func NewClientWithConf(config *AuthConfig) *Client

func (*Client) AddAdapter

func (c *Client) AddAdapter(adapter *Adapter) (bool, error)

func (*Client) AddApplication

func (c *Client) AddApplication(application *Application) (bool, error)

func (*Client) AddCert

func (c *Client) AddCert(cert *Cert) (bool, error)

func (*Client) AddEnforcer

func (c *Client) AddEnforcer(enforcer *Enforcer) (bool, error)

func (*Client) AddGroup

func (c *Client) AddGroup(group *Group) (bool, error)

func (*Client) AddInvitation

func (c *Client) AddInvitation(invitation *Invitation) (bool, error)

func (*Client) AddLdap

func (c *Client) AddLdap(ldap *Ldap) (bool, error)

func (*Client) AddModel

func (c *Client) AddModel(model *Model) (bool, error)

func (*Client) AddOrder

func (c *Client) AddOrder(order *Order) (bool, error)

func (*Client) AddOrganization

func (c *Client) AddOrganization(organization *Organization) (bool, error)

func (*Client) AddPayment

func (c *Client) AddPayment(payment *Payment) (bool, error)

func (*Client) AddPermission

func (c *Client) AddPermission(permission *Permission) (bool, error)

func (*Client) AddPlan

func (c *Client) AddPlan(plan *Plan) (bool, error)

func (*Client) AddPolicy

func (c *Client) AddPolicy(enforcer *Enforcer, policy *CasbinRule) (bool, error)

func (*Client) AddPricing

func (c *Client) AddPricing(pricing *Pricing) (bool, error)

func (*Client) AddProduct

func (c *Client) AddProduct(product *Product) (bool, error)

func (*Client) AddProvider

func (c *Client) AddProvider(provider *Provider) (bool, error)

func (*Client) AddRecord

func (c *Client) AddRecord(record *Record) (bool, error)

func (*Client) AddRole

func (c *Client) AddRole(role *Role) (bool, error)

func (*Client) AddSession

func (c *Client) AddSession(session *Session) (bool, error)

func (*Client) AddSubscription

func (c *Client) AddSubscription(subscription *Subscription) (bool, error)

func (*Client) AddSyncer

func (c *Client) AddSyncer(syncer *Syncer) (bool, error)

func (*Client) AddToken

func (c *Client) AddToken(token *Token) (bool, error)

func (*Client) AddTransaction

func (c *Client) AddTransaction(transaction *Transaction) (bool, string, error)

func (*Client) AddTransactionWithDryRun

func (c *Client) AddTransactionWithDryRun(transaction *Transaction, dryrun bool) (bool, string, error)

func (*Client) AddUser

func (c *Client) AddUser(user *User) (bool, error)

func (*Client) AddWebhook

func (c *Client) AddWebhook(webhook *Webhook) (bool, error)

func (*Client) BatchEnforce

func (c *Client) BatchEnforce(permissionId string, modelId string, resourceId string, enforcerId string, owner string, casbinRequests []CasbinRequest) ([][]bool, error)

func (*Client) BuyProduct

func (c *Client) BuyProduct(name string, providerName string, userName string) (*Order, error)

func (*Client) CancelOrder

func (c *Client) CancelOrder(name string) (bool, error)

func (*Client) CheckUserPassword

func (c *Client) CheckUserPassword(user *User) (bool, error)

func (*Client) Delete

func (c *Client) Delete(owner, name string) error

func (*Client) DeleteAdapter

func (c *Client) DeleteAdapter(adapter *Adapter) (bool, error)

func (*Client) DeleteApplication

func (c *Client) DeleteApplication(application *Application) (bool, error)

func (*Client) DeleteCert

func (c *Client) DeleteCert(cert *Cert) (bool, error)

func (*Client) DeleteEnforcer

func (c *Client) DeleteEnforcer(enforcer *Enforcer) (bool, error)

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(group *Group) (bool, error)

func (*Client) DeleteInvitation

func (c *Client) DeleteInvitation(invitation *Invitation) (bool, error)

func (*Client) DeleteLdap

func (c *Client) DeleteLdap(ldap *Ldap) (bool, error)

func (*Client) DeleteModel

func (c *Client) DeleteModel(model *Model) (bool, error)

func (*Client) DeleteOrder

func (c *Client) DeleteOrder(order *Order) (bool, error)

func (*Client) DeleteOrganization

func (c *Client) DeleteOrganization(organization *Organization) (bool, error)

func (*Client) DeletePayment

func (c *Client) DeletePayment(payment *Payment) (bool, error)

func (*Client) DeletePermission

func (c *Client) DeletePermission(permission *Permission) (bool, error)

func (*Client) DeletePlan

func (c *Client) DeletePlan(plan *Plan) (bool, error)

func (*Client) DeletePricing

func (c *Client) DeletePricing(pricing *Pricing) (bool, error)

func (*Client) DeleteProduct

func (c *Client) DeleteProduct(product *Product) (bool, error)

func (*Client) DeleteProvider

func (c *Client) DeleteProvider(provider *Provider) (bool, error)

func (*Client) DeleteResource

func (c *Client) DeleteResource(resource *Resource) (bool, error)

func (*Client) DeleteResourceWithTag

func (c *Client) DeleteResourceWithTag(resource *Resource, tag string) (bool, error)

func (*Client) DeleteRole

func (c *Client) DeleteRole(role *Role) (bool, error)

func (*Client) DeleteSession

func (c *Client) DeleteSession(session *Session) (bool, error)

func (*Client) DeleteSubscription

func (c *Client) DeleteSubscription(subscription *Subscription) (bool, error)

func (*Client) DeleteSyncer

func (c *Client) DeleteSyncer(syncer *Syncer) (bool, error)

func (*Client) DeleteToken

func (c *Client) DeleteToken(token *Token) (bool, error)

func (*Client) DeleteTransaction

func (c *Client) DeleteTransaction(transaction *Transaction) (bool, error)

func (*Client) DeleteUser

func (c *Client) DeleteUser(user *User) (bool, error)

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(webhook *Webhook) (bool, error)

func (*Client) DoGetBytes

func (c *Client) DoGetBytes(url string) ([]byte, error)

DoGetBytes is a general function to get response data in bytes from param url through HTTP Get method.

func (*Client) DoGetBytesRaw

func (c *Client) DoGetBytesRaw(url string) ([]byte, error)

DoGetBytesRaw is a general function to get response from param url through HTTP Get method.

func (*Client) DoGetResponse

func (c *Client) DoGetResponse(url string) (*Response, error)

DoGetResponse is a general function to get response from param url through HTTP Get method.

func (*Client) DoPost

func (c *Client) DoPost(action string, queryMap map[string]string, postBytes []byte, isForm, isFile bool) (*Response, error)

func (*Client) DoPostBytesRaw

func (c *Client) DoPostBytesRaw(url string, contentType string, body io.Reader) ([]byte, error)

DoPostBytesRaw is a general function to post a request from url, body through HTTP Post method.

func (*Client) Enable

func (c *Client) Enable(owner, mfaType, name, secret string, recoveryCode string) (*MfaVerifyResponse, error)

func (*Client) Enforce

func (c *Client) Enforce(permissionId string, modelId string, resourceId string, enforcerId string, owner string, casbinRequest CasbinRequest) (bool, error)

func (*Client) GetAdapter

func (c *Client) GetAdapter(name string) (*Adapter, error)

func (*Client) GetAdapters

func (c *Client) GetAdapters() ([]*Adapter, error)

func (*Client) GetApplication

func (c *Client) GetApplication(name string) (*Application, error)

func (*Client) GetApplications

func (c *Client) GetApplications() ([]*Application, error)

func (*Client) GetCert

func (c *Client) GetCert(name string) (*Cert, error)

func (*Client) GetCerts

func (c *Client) GetCerts() ([]*Cert, error)

func (*Client) GetEnforcer

func (c *Client) GetEnforcer(name string) (*Enforcer, error)

func (*Client) GetEnforcers

func (c *Client) GetEnforcers() ([]*Enforcer, error)

func (*Client) GetFilteredPolicies

func (c *Client) GetFilteredPolicies(enforcerId string, filters []*PolicyFilter) ([]*CasbinRule, error)

GetFilteredPolicies gets policies with filtering capabilities based on field index and values

func (*Client) GetGlobalCerts

func (c *Client) GetGlobalCerts() ([]*Cert, error)

func (*Client) GetGlobalUsers

func (c *Client) GetGlobalUsers() ([]*User, error)

func (*Client) GetGroup

func (c *Client) GetGroup(name string) (*Group, error)

func (*Client) GetGroups

func (c *Client) GetGroups() ([]*Group, error)

func (*Client) GetId

func (c *Client) GetId(name string) string

func (*Client) GetInvitation

func (c *Client) GetInvitation(name string) (*Invitation, error)

func (*Client) GetInvitationInfo

func (c *Client) GetInvitationInfo(code string, applicationName string) (*Invitation, error)

func (*Client) GetInvitations

func (c *Client) GetInvitations() ([]*Invitation, error)

func (*Client) GetLdap

func (c *Client) GetLdap(id string) (*Ldap, error)

func (*Client) GetLdapUsers

func (c *Client) GetLdapUsers(id string) (*LdapUsersResponse, error)

func (*Client) GetLdaps

func (c *Client) GetLdaps() ([]*Ldap, error)

func (*Client) GetModel

func (c *Client) GetModel(name string) (*Model, error)

func (*Client) GetModels

func (c *Client) GetModels() ([]*Model, error)

func (*Client) GetMyProfileUrl

func (c *Client) GetMyProfileUrl(accessToken string) string

func (*Client) GetOAuthToken

func (c *Client) GetOAuthToken(code string, state string, opts ...OAuthOption) (*oauth2.Token, error)

GetOAuthToken gets the pivotal and necessary secret to interact with the HanzoIAM server

func (*Client) GetOrder

func (c *Client) GetOrder(name string) (*Order, error)

func (*Client) GetOrders

func (c *Client) GetOrders() ([]*Order, error)

func (*Client) GetOrganization

func (c *Client) GetOrganization(name string) (*Organization, error)

func (*Client) GetOrganizationApplications

func (c *Client) GetOrganizationApplications() ([]*Application, error)

func (*Client) GetOrganizationNames

func (c *Client) GetOrganizationNames() ([]*Organization, error)

func (*Client) GetOrganizations

func (c *Client) GetOrganizations() ([]*Organization, error)

func (*Client) GetPaginationAdapters

func (c *Client) GetPaginationAdapters(p int, pageSize int, queryMap map[string]string) ([]*Adapter, int, error)

func (*Client) GetPaginationEnforcers

func (c *Client) GetPaginationEnforcers(p int, pageSize int, queryMap map[string]string) ([]*Enforcer, int, error)

func (*Client) GetPaginationGroups

func (c *Client) GetPaginationGroups(p int, pageSize int, queryMap map[string]string) ([]*Group, int, error)

func (*Client) GetPaginationInvitations

func (c *Client) GetPaginationInvitations(p int, pageSize int, queryMap map[string]string) ([]*Invitation, int, error)

func (*Client) GetPaginationModels

func (c *Client) GetPaginationModels(p int, pageSize int, queryMap map[string]string) ([]*Model, int, error)

func (*Client) GetPaginationOrders

func (c *Client) GetPaginationOrders(p int, pageSize int, queryMap map[string]string) ([]*Order, int, error)

func (*Client) GetPaginationPayments

func (c *Client) GetPaginationPayments(p int, pageSize int, queryMap map[string]string) ([]*Payment, int, error)

func (*Client) GetPaginationPermissions

func (c *Client) GetPaginationPermissions(p int, pageSize int, queryMap map[string]string) ([]*Permission, int, error)

func (*Client) GetPaginationPlans

func (c *Client) GetPaginationPlans(p int, pageSize int, queryMap map[string]string) ([]*Plan, int, error)

func (*Client) GetPaginationPricings

func (c *Client) GetPaginationPricings(p int, pageSize int, queryMap map[string]string) ([]*Pricing, int, error)

func (*Client) GetPaginationProducts

func (c *Client) GetPaginationProducts(p int, pageSize int, queryMap map[string]string) ([]*Product, int, error)

func (*Client) GetPaginationProviders

func (c *Client) GetPaginationProviders(p int, pageSize int, queryMap map[string]string) ([]*Provider, int, error)

func (*Client) GetPaginationRecords

func (c *Client) GetPaginationRecords(p int, pageSize int, queryMap map[string]string) ([]*Record, int, error)

func (*Client) GetPaginationResources

func (c *Client) GetPaginationResources(owner, user, field, value string, pageSize, page int, sortField, sortOrder string) ([]*Resource, error)

func (*Client) GetPaginationRoles

func (c *Client) GetPaginationRoles(p int, pageSize int, queryMap map[string]string) ([]*Role, int, error)

func (*Client) GetPaginationSessions

func (c *Client) GetPaginationSessions(p int, pageSize int, queryMap map[string]string) ([]*Session, int, error)

func (*Client) GetPaginationSubscriptions

func (c *Client) GetPaginationSubscriptions(p int, pageSize int, queryMap map[string]string) ([]*Subscription, int, error)

func (*Client) GetPaginationSyncers

func (c *Client) GetPaginationSyncers(p int, pageSize int, queryMap map[string]string) ([]*Syncer, int, error)

func (*Client) GetPaginationTokens

func (c *Client) GetPaginationTokens(p int, pageSize int, queryMap map[string]string) ([]*Token, int, error)

func (*Client) GetPaginationTransactions

func (c *Client) GetPaginationTransactions(p int, pageSize int, queryMap map[string]string) ([]*Transaction, int, error)

func (*Client) GetPaginationUsers

func (c *Client) GetPaginationUsers(p int, pageSize int, queryMap map[string]string) ([]*User, int, error)

func (*Client) GetPaginationWebhooks

func (c *Client) GetPaginationWebhooks(p int, pageSize int, queryMap map[string]string) ([]*Webhook, int, error)

func (*Client) GetPayment

func (c *Client) GetPayment(name string) (*Payment, error)

func (*Client) GetPayments

func (c *Client) GetPayments() ([]*Payment, error)

func (*Client) GetPermission

func (c *Client) GetPermission(name string) (*Permission, error)

func (*Client) GetPermissions

func (c *Client) GetPermissions() ([]*Permission, error)

func (*Client) GetPermissionsByRole

func (c *Client) GetPermissionsByRole(name string) ([]*Permission, error)

func (*Client) GetPlan

func (c *Client) GetPlan(name string) (*Plan, error)

func (*Client) GetPlans

func (c *Client) GetPlans() ([]*Plan, error)

func (*Client) GetPolicies

func (c *Client) GetPolicies(enforcerName string, adapterId string) ([]*CasbinRule, error)

func (*Client) GetPricing

func (c *Client) GetPricing(name string) (*Pricing, error)

func (*Client) GetPricings

func (c *Client) GetPricings() ([]*Pricing, error)

func (*Client) GetProduct

func (c *Client) GetProduct(name string) (*Product, error)

func (*Client) GetProducts

func (c *Client) GetProducts() ([]*Product, error)

func (*Client) GetProvider

func (c *Client) GetProvider(name string) (*Provider, error)

func (*Client) GetProviders

func (c *Client) GetProviders() ([]*Provider, error)

func (*Client) GetRecord

func (c *Client) GetRecord(name string) (*Record, error)

func (*Client) GetRecords

func (c *Client) GetRecords() ([]*Record, error)

func (*Client) GetResource

func (c *Client) GetResource(id string) (*Resource, error)

func (*Client) GetResourceEx

func (c *Client) GetResourceEx(owner, name string) (*Resource, error)

func (*Client) GetResources

func (c *Client) GetResources(owner, user, field, value, sortField, sortOrder string) ([]*Resource, error)

func (*Client) GetRole

func (c *Client) GetRole(name string) (*Role, error)

func (*Client) GetRoles

func (c *Client) GetRoles() ([]*Role, error)

func (*Client) GetSession

func (c *Client) GetSession(name string, application string) (*Session, error)

func (*Client) GetSessions

func (c *Client) GetSessions() ([]*Session, error)

func (*Client) GetSigninUrl

func (c *Client) GetSigninUrl(redirectUri string) string

func (*Client) GetSignupUrl

func (c *Client) GetSignupUrl(enablePassword bool, redirectUri string) string

func (*Client) GetSortedUsers

func (c *Client) GetSortedUsers(sorter string, limit int) ([]*User, error)

func (*Client) GetSubscription

func (c *Client) GetSubscription(name string) (*Subscription, error)

func (*Client) GetSubscriptions

func (c *Client) GetSubscriptions() ([]*Subscription, error)

func (*Client) GetSyncer

func (c *Client) GetSyncer(name string) (*Syncer, error)

func (*Client) GetSyncers

func (c *Client) GetSyncers() ([]*Syncer, error)

func (*Client) GetToken

func (c *Client) GetToken(name string) (*Token, error)

func (*Client) GetTokens

func (c *Client) GetTokens() ([]*Token, error)

func (*Client) GetTransaction

func (c *Client) GetTransaction(name string) (*Transaction, error)

func (*Client) GetTransactions

func (c *Client) GetTransactions() ([]*Transaction, error)

func (*Client) GetUrl

func (c *Client) GetUrl(action string, queryMap map[string]string) string

func (*Client) GetUser

func (c *Client) GetUser(name string) (*User, error)

func (*Client) GetUserByEmail

func (c *Client) GetUserByEmail(email string) (*User, error)

func (*Client) GetUserByPhone

func (c *Client) GetUserByPhone(phone string) (*User, error)

func (*Client) GetUserByUserId

func (c *Client) GetUserByUserId(userId string) (*User, error)

func (*Client) GetUserCount

func (c *Client) GetUserCount(isOnline string) (int, error)

func (*Client) GetUserOrders

func (c *Client) GetUserOrders(userName string) ([]*Order, error)

func (*Client) GetUserPayments

func (c *Client) GetUserPayments(userName string) ([]*Payment, error)

func (*Client) GetUserProfileUrl

func (c *Client) GetUserProfileUrl(userName string, accessToken string) string

func (*Client) GetUserTransactions

func (c *Client) GetUserTransactions(userName string) ([]*Transaction, error)

func (*Client) GetUsers

func (c *Client) GetUsers() ([]*User, error)

func (*Client) GetWebhook

func (c *Client) GetWebhook(name string) (*Webhook, error)

func (*Client) GetWebhooks

func (c *Client) GetWebhooks() ([]*Webhook, error)

func (*Client) Initiate

func (c *Client) Initiate(owner, mfaType, name string) (*MfaInitiateResponse, error)

func (*Client) IntrospectToken

func (c *Client) IntrospectToken(token, tokenTypeHint string) (result *IntrospectTokenResult, err error)

func (*Client) InvoicePayment

func (c *Client) InvoicePayment(payment *Payment) (bool, error)

func (*Client) NotifyPayment

func (c *Client) NotifyPayment(payment *Payment) (bool, error)

func (*Client) ParseJwtToken

func (c *Client) ParseJwtToken(token string) (*Claims, error)

func (*Client) PayOrder

func (c *Client) PayOrder(orderName string, providerName string) (*Payment, error)

func (*Client) PlaceOrder

func (c *Client) PlaceOrder(productInfos []ProductInfo, userName string) (*Order, error)

func (*Client) RefreshOAuthToken

func (c *Client) RefreshOAuthToken(refreshToken string, opts ...OAuthOption) (*oauth2.Token, error)

RefreshOAuthToken refreshes the OAuth token

func (*Client) RemovePolicy

func (c *Client) RemovePolicy(enforcer *Enforcer, policy *CasbinRule) (bool, error)

func (*Client) SendEmail

func (c *Client) SendEmail(title string, content string, sender string, receivers ...string) error

func (*Client) SendEmailByProvider

func (c *Client) SendEmailByProvider(title string, content string, sender string, provider string, receivers ...string) error

func (*Client) SendSms

func (c *Client) SendSms(content string, receivers ...string) error

func (*Client) SendSmsByProvider

func (c *Client) SendSmsByProvider(content string, provider string, receivers ...string) error

func (*Client) SetPassword

func (c *Client) SetPassword(owner, name, oldPassword, newPassword string) (bool, error)

note: oldPassword is not required, if you don't need, just pass a empty string

func (*Client) SetPreferred

func (c *Client) SetPreferred(owner, mfaType, name, secret string) error

func (*Client) SyncLdapUsers

func (c *Client) SyncLdapUsers(id string, users []*LdapUser) (*SyncLdapUsersResponse, error)

func (*Client) SyncLdapUsersFromServer

func (c *Client) SyncLdapUsersFromServer(id string) (*SyncLdapUsersResponse, error)

func (*Client) UpdateAdapter

func (c *Client) UpdateAdapter(adapter *Adapter) (bool, error)

func (*Client) UpdateApplication

func (c *Client) UpdateApplication(application *Application) (bool, error)

func (*Client) UpdateCert

func (c *Client) UpdateCert(cert *Cert) (bool, error)

func (*Client) UpdateEnforcer

func (c *Client) UpdateEnforcer(enforcer *Enforcer) (bool, error)

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(group *Group) (bool, error)

func (*Client) UpdateInvitation

func (c *Client) UpdateInvitation(invitation *Invitation) (bool, error)

func (*Client) UpdateInvitationForColumns

func (c *Client) UpdateInvitationForColumns(invitation *Invitation, columns []string) (bool, error)

func (*Client) UpdateLdap

func (c *Client) UpdateLdap(ldap *Ldap) (bool, error)

func (*Client) UpdateModel

func (c *Client) UpdateModel(model *Model) (bool, error)

func (*Client) UpdateOrder

func (c *Client) UpdateOrder(order *Order) (bool, error)

func (*Client) UpdateOrganization

func (c *Client) UpdateOrganization(organization *Organization) (bool, error)

func (*Client) UpdatePayment

func (c *Client) UpdatePayment(payment *Payment) (bool, error)

func (*Client) UpdatePermission

func (c *Client) UpdatePermission(permission *Permission) (bool, error)

func (*Client) UpdatePermissionForColumns

func (c *Client) UpdatePermissionForColumns(permission *Permission, columns []string) (bool, error)

func (*Client) UpdatePlan

func (c *Client) UpdatePlan(plan *Plan) (bool, error)

func (*Client) UpdatePolicy

func (c *Client) UpdatePolicy(enforcer *Enforcer, oldpolicy *CasbinRule, newpolicy *CasbinRule) (bool, error)

func (*Client) UpdatePricing

func (c *Client) UpdatePricing(pricing *Pricing) (bool, error)

func (*Client) UpdateProduct

func (c *Client) UpdateProduct(product *Product) (bool, error)

func (*Client) UpdateProvider

func (c *Client) UpdateProvider(provider *Provider) (bool, error)

func (*Client) UpdateRole

func (c *Client) UpdateRole(role *Role) (bool, error)

func (*Client) UpdateRoleForColumns

func (c *Client) UpdateRoleForColumns(role *Role, columns []string) (bool, error)

func (*Client) UpdateSession

func (c *Client) UpdateSession(session *Session) (bool, error)

func (*Client) UpdateSessionForColumns

func (c *Client) UpdateSessionForColumns(session *Session, columns []string) (bool, error)

func (*Client) UpdateSubscription

func (c *Client) UpdateSubscription(subscription *Subscription) (bool, error)

func (*Client) UpdateSyncer

func (c *Client) UpdateSyncer(syncer *Syncer) (bool, error)

func (*Client) UpdateToken

func (c *Client) UpdateToken(token *Token) (bool, error)

func (*Client) UpdateTokenForColumns

func (c *Client) UpdateTokenForColumns(token *Token, columns []string) (bool, error)

func (*Client) UpdateTransaction

func (c *Client) UpdateTransaction(transaction *Transaction) (bool, error)

func (*Client) UpdateUser

func (c *Client) UpdateUser(user *User) (bool, error)

func (*Client) UpdateUserById

func (c *Client) UpdateUserById(id string, user *User) (bool, error)

func (*Client) UpdateUserByUserId

func (c *Client) UpdateUserByUserId(owner string, userId string, user *User) (bool, error)

func (*Client) UpdateUserForColumns

func (c *Client) UpdateUserForColumns(user *User, columns []string) (bool, error)

func (*Client) UpdateWebhook

func (c *Client) UpdateWebhook(webhook *Webhook) (bool, error)

func (*Client) UploadResource

func (c *Client) UploadResource(user string, tag string, parent string, fullFilePath string, fileBytes []byte) (string, string, error)

func (*Client) UploadResourceEx

func (c *Client) UploadResourceEx(user string, tag string, parent string, fullFilePath string, fileBytes []byte, createdTime string, description string) (string, string, error)

func (*Client) Verify

func (c *Client) Verify(owner, mfaType, name, secret, passcode string) (*MfaVerifyResponse, error)

type Enforcer

type Enforcer struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100) updated" json:"updatedTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Model     string `xorm:"varchar(100)" json:"model"`
	Adapter   string `xorm:"varchar(100)" json:"adapter"`
	IsEnabled bool   `json:"isEnabled"`
}

func GetEnforcer

func GetEnforcer(name string) (*Enforcer, error)

func GetEnforcers

func GetEnforcers() ([]*Enforcer, error)

func GetPaginationEnforcers

func GetPaginationEnforcers(p int, pageSize int, queryMap map[string]string) ([]*Enforcer, int, error)

type FaceId

type FaceId struct {
	Name       string    `xorm:"varchar(100) notnull pk" json:"name"`
	FaceIdData []float64 `json:"faceIdData"`
	ImageUrl   string    `json:"ImageUrl"`
}

type Group

type Group struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk unique index" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`

	DisplayName  string   `xorm:"varchar(100)" json:"displayName"`
	Manager      string   `xorm:"varchar(100)" json:"manager"`
	ContactEmail string   `xorm:"varchar(100)" json:"contactEmail"`
	Type         string   `xorm:"varchar(100)" json:"type"`
	ParentId     string   `xorm:"varchar(100)" json:"parentId"`
	IsTopGroup   bool     `xorm:"bool" json:"isTopGroup"`
	Users        []string `xorm:"mediumtext" json:"users"`

	Title    string   `json:"title,omitempty"`
	Key      string   `json:"key,omitempty"`
	Children []*Group `json:"children,omitempty"`

	IsEnabled bool `json:"isEnabled"`
}

func GetGroup

func GetGroup(name string) (*Group, error)

func GetGroups

func GetGroups() ([]*Group, error)

func GetPaginationGroups

func GetPaginationGroups(p int, pageSize int, queryMap map[string]string) ([]*Group, int, error)
type Header struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type HttpClient

type HttpClient interface {
	Do(*http.Request) (*http.Response, error)
}

HttpClient interface has the method required to use a type as custom http client. The net/*http.Client type satisfies this interface.

type IntrospectTokenResult

type IntrospectTokenResult struct {
	Active    bool     `json:"active"`
	ClientId  string   `json:"client_id"`
	Username  string   `json:"username"`
	TokenType string   `json:"token_type"`
	Exp       uint     `json:"exp"`
	Iat       uint     `json:"iat"`
	Nbf       uint     `json:"nbf"`
	Sub       string   `json:"sub"`
	Aud       []string `json:"aud"`
	Iss       string   `json:"iss"`
	Jti       string   `json:"jti"`
}

type Invitation

type Invitation struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Code      string `xorm:"varchar(100) index" json:"code"`
	IsRegexp  bool   `json:"isRegexp"`
	Quota     int    `json:"quota"`
	UsedCount int    `json:"usedCount"`

	Application string `xorm:"varchar(100)" json:"application"`
	Username    string `xorm:"varchar(100)" json:"username"`
	Email       string `xorm:"varchar(100)" json:"email"`
	Phone       string `xorm:"varchar(100)" json:"phone"`

	SignupGroup string `xorm:"varchar(100)" json:"signupGroup"`
	DefaultCode string `xorm:"varchar(100)" json:"defaultCode"`

	State string `xorm:"varchar(100)" json:"state"`
}

Invitation has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/invitation.go

func GetInvitation

func GetInvitation(name string) (*Invitation, error)

func GetInvitationInfo

func GetInvitationInfo(code string, applicationName string) (*Invitation, error)

func GetInvitations

func GetInvitations() ([]*Invitation, error)

func GetPaginationInvitations

func GetPaginationInvitations(p int, pageSize int, queryMap map[string]string) ([]*Invitation, int, error)

func (Invitation) GetId

func (i Invitation) GetId() string

type JwtItem

type JwtItem struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Type  string `json:"type"`
}

type Ldap

type Ldap struct {
	Id          string `xorm:"varchar(100) notnull pk" json:"id"`
	Owner       string `xorm:"varchar(100)" json:"owner"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	ServerName          string            `xorm:"varchar(100)" json:"serverName"`
	Host                string            `xorm:"varchar(100)" json:"host"`
	Port                int               `xorm:"int" json:"port"`
	EnableSsl           bool              `xorm:"bool" json:"enableSsl"`
	AllowSelfSignedCert bool              `xorm:"bool" json:"allowSelfSignedCert"`
	Username            string            `xorm:"varchar(100)" json:"username"`
	Password            string            `xorm:"varchar(100)" json:"password"`
	BaseDn              string            `xorm:"varchar(500)" json:"baseDn"`
	Filter              string            `xorm:"varchar(200)" json:"filter"`
	FilterFields        []string          `xorm:"varchar(100)" json:"filterFields"`
	DefaultGroup        string            `xorm:"varchar(100)" json:"defaultGroup"`
	PasswordType        string            `xorm:"varchar(100)" json:"passwordType"`
	CustomAttributes    map[string]string `json:"customAttributes"`

	AutoSync int    `json:"autoSync"`
	LastSync string `xorm:"varchar(100)" json:"lastSync"`
}

func GetLdap

func GetLdap(id string) (*Ldap, error)

func GetLdaps

func GetLdaps() ([]*Ldap, error)

type LdapUser

type LdapUser struct {
	UidNumber             string            `json:"uidNumber"`
	Uid                   string            `json:"uid"`
	Cn                    string            `json:"cn"`
	GidNumber             string            `json:"gidNumber"`
	Uuid                  string            `json:"uuid"`
	UserPrincipalName     string            `json:"userPrincipalName"`
	DisplayName           string            `json:"displayName"`
	Mail                  string            `json:"mail"`
	Email                 string            `json:"email"`
	EmailAddress          string            `json:"emailAddress"`
	TelephoneNumber       string            `json:"telephoneNumber"`
	Mobile                string            `json:"mobile"`
	MobileTelephoneNumber string            `json:"mobileTelephoneNumber"`
	RegisteredAddress     string            `json:"registeredAddress"`
	PostalAddress         string            `json:"postalAddress"`
	Country               string            `json:"country"`
	CountryName           string            `json:"countryName"`
	GroupId               string            `json:"groupId"`
	Address               string            `json:"address"`
	MemberOf              string            `json:"memberOf"`
	Attributes            map[string]string `json:"attributes"`
}

type LdapUsersResponse

type LdapUsersResponse struct {
	ExistUuids []string    `json:"existUuids"`
	Users      []*LdapUser `json:"users"`
}

func GetLdapUsers

func GetLdapUsers(id string) (*LdapUsersResponse, error)

type ManagedAccount

type ManagedAccount struct {
	Application string `xorm:"varchar(100)" json:"application"`
	Username    string `xorm:"varchar(100)" json:"username"`
	Password    string `xorm:"varchar(100)" json:"password"`
	SigninUrl   string `xorm:"varchar(200)" json:"signinUrl"`
}

type MfaAccount

type MfaAccount struct {
	AccountName string `xorm:"varchar(100)" json:"accountName"`
	Issuer      string `xorm:"varchar(100)" json:"issuer"`
	SecretKey   string `xorm:"varchar(100)" json:"secretKey"`
	Origin      string `xorm:"varchar(100)" json:"origin"`
}

type MfaInitiateResponse

type MfaInitiateResponse struct {
	Status string `json:"status"`
	Msg    string `json:"msg"`
	Data   struct {
		Enabled            bool     `json:"enabled"`
		IsPreferred        bool     `json:"isPreferred"`
		MfaRememberInHours int      `json:"mfaRememberInHours"`
		MfaType            string   `json:"mfaType"`
		RecoveryCodes      []string `json:"recoveryCodes"`
		Secret             string   `json:"secret"`
		URL                string   `json:"url"`
	} `json:"data"`
}

type MfaItem

type MfaItem struct {
	Name string `json:"name"`
	Rule string `json:"rule"`
}

type MfaProps

type MfaProps struct {
	Enabled       bool     `json:"enabled"`
	IsPreferred   bool     `json:"isPreferred"`
	MfaType       string   `json:"mfaType" form:"mfaType"`
	Secret        string   `json:"secret,omitempty"`
	CountryCode   string   `json:"countryCode,omitempty"`
	URL           string   `json:"url,omitempty"`
	RecoveryCodes []string `json:"recoveryCodes,omitempty"`
}

type MfaRequest

type MfaRequest struct {
	Owner        string `json:"owner"`
	MfaType      string `json:"mfaType"`
	Name         string `json:"name"`
	Secret       string `json:"secret,omitempty"`
	RecoveryCode string `json:"recoveryCodes,omitempty"`
}

type MfaType

type MfaType string

type MfaVerifyResponse

type MfaVerifyResponse struct {
	Status string `json:"status"`
	Msg    string `json:"msg"`
	Data   string `json:"data"`
}

type Model

type Model struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk unique index" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`

	DisplayName  string  `xorm:"varchar(100)" json:"displayName"`
	Manager      string  `xorm:"varchar(100)" json:"manager"`
	ContactEmail string  `xorm:"varchar(100)" json:"contactEmail"`
	Type         string  `xorm:"varchar(100)" json:"type"`
	ParentId     string  `xorm:"varchar(100)" json:"parentId"`
	IsTopModel   bool    `xorm:"bool" json:"isTopModel"`
	Users        []*User `xorm:"-" json:"users"`

	Title    string   `json:"title,omitempty"`
	Key      string   `json:"key,omitempty"`
	Children []*Model `json:"children,omitempty"`

	ModelText string `xorm:"mediumtext" json:"modelText"`
	IsEnabled bool   `json:"isEnabled"`
}

func GetModel

func GetModel(name string) (*Model, error)

func GetModels

func GetModels() ([]*Model, error)

func GetPaginationModels

func GetPaginationModels(p int, pageSize int, queryMap map[string]string) ([]*Model, int, error)

type OAuthOption

type OAuthOption func(*oauthOptions)

OAuthOption is a function type for configuring OAuth requests.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) OAuthOption

WithHTTPClient sets a custom http client for oauth operations.

type Order

type Order struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdateTime  string `xorm:"varchar(100)" json:"updateTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	// Product Info
	Products     []string      `xorm:"varchar(1000)" json:"products"` // Support for multiple products per order. Using varchar(1000) for simple JSON array storage; can be refactored to separate table if needed
	ProductInfos []ProductInfo `xorm:"mediumtext" json:"productInfos"`

	// User Info
	User string `xorm:"varchar(100)" json:"user"`

	// Payment Info
	Payment  string  `xorm:"varchar(100)" json:"payment"`
	Price    float64 `json:"price"`
	Currency string  `xorm:"varchar(100)" json:"currency"`

	// Order State
	State   string `xorm:"varchar(100)" json:"state"`
	Message string `xorm:"varchar(2000)" json:"message"`
}

func BuyProduct

func BuyProduct(name string, providerName string, userName string) (*Order, error)

func GetOrder

func GetOrder(name string) (*Order, error)

func GetOrders

func GetOrders() ([]*Order, error)

func GetPaginationOrders

func GetPaginationOrders(p int, pageSize int, queryMap map[string]string) ([]*Order, int, error)

func GetUserOrders

func GetUserOrders(userName string) ([]*Order, error)

func PlaceOrder

func PlaceOrder(productInfos []ProductInfo, userName string) (*Order, error)

func (*Order) GetId

func (order *Order) GetId() string

type Organization

type Organization struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	DisplayName            string     `xorm:"varchar(100)" json:"displayName"`
	WebsiteUrl             string     `xorm:"varchar(100)" json:"websiteUrl"`
	LogoDark               string     `xorm:"varchar(200)" json:"logoDark"`
	Favicon                string     `xorm:"varchar(200)" json:"favicon"`
	HasPrivilegeConsent    bool       `xorm:"bool" json:"hasPrivilegeConsent"`
	PasswordType           string     `xorm:"varchar(100)" json:"passwordType"`
	PasswordSalt           string     `xorm:"varchar(100)" json:"passwordSalt"`
	PasswordOptions        []string   `xorm:"varchar(100)" json:"passwordOptions"`
	PasswordObfuscatorType string     `xorm:"varchar(100)" json:"passwordObfuscatorType"`
	PasswordObfuscatorKey  string     `xorm:"varchar(100)" json:"passwordObfuscatorKey"`
	PasswordExpireDays     int        `json:"passwordExpireDays"`
	CountryCodes           []string   `xorm:"mediumtext"  json:"countryCodes"`
	DefaultAvatar          string     `xorm:"varchar(200)" json:"defaultAvatar"`
	DefaultApplication     string     `xorm:"varchar(100)" json:"defaultApplication"`
	UserTypes              []string   `xorm:"mediumtext" json:"userTypes"`
	Tags                   []string   `xorm:"mediumtext" json:"tags"`
	Languages              []string   `xorm:"varchar(255)" json:"languages"`
	ThemeData              *ThemeData `xorm:"json" json:"themeData"`
	MasterPassword         string     `xorm:"varchar(200)" json:"masterPassword"`
	DefaultPassword        string     `xorm:"varchar(200)" json:"defaultPassword"`
	MasterVerificationCode string     `xorm:"varchar(100)" json:"masterVerificationCode"`
	IpWhitelist            string     `xorm:"varchar(200)" json:"ipWhitelist"`
	InitScore              int        `json:"initScore"`
	EnableSoftDeletion     bool       `json:"enableSoftDeletion"`
	IsProfilePublic        bool       `json:"isProfilePublic"`
	UseEmailAsUsername     bool       `json:"useEmailAsUsername"`
	EnableTour             bool       `json:"enableTour"`
	DisableSignin          bool       `json:"disableSignin"`
	IpRestriction          string     `json:"ipRestriction"`
	NavItems               []string   `xorm:"mediumtext" json:"navItems"`
	UserNavItems           []string   `xorm:"mediumtext" json:"userNavItems"`
	WidgetItems            []string   `xorm:"mediumtext" json:"widgetItems"`

	MfaItems           []*MfaItem     `xorm:"varchar(300)" json:"mfaItems"`
	MfaRememberInHours int            `json:"mfaRememberInHours"`
	AccountItems       []*AccountItem `xorm:"mediumtext" json:"accountItems"`

	OrgBalance      float64 `json:"orgBalance"`
	UserBalance     float64 `json:"userBalance"`
	BalanceCredit   float64 `json:"balanceCredit"`
	BalanceCurrency string  `xorm:"varchar(100)" json:"balanceCurrency"`
}

Organization has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/organization.go#L50

func GetOrganization

func GetOrganization(name string) (*Organization, error)

func GetOrganizationNames

func GetOrganizationNames() ([]*Organization, error)

func GetOrganizations

func GetOrganizations() ([]*Organization, error)

type Payment

type Payment struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	// Payment Provider Info
	Provider string `xorm:"varchar(100)" json:"provider"`
	Type     string `xorm:"varchar(100)" json:"type"`
	// Product Info
	Products            []string `xorm:"varchar(1000)" json:"products"`
	ProductsDisplayName string   `xorm:"varchar(1000)" json:"productsDisplayName"`
	Detail              string   `xorm:"varchar(255)" json:"detail"`
	Currency            string   `xorm:"varchar(100)" json:"currency"`
	Price               float64  `json:"price"`

	// Payer Info
	User         string `xorm:"varchar(100)" json:"user"`
	PersonName   string `xorm:"varchar(100)" json:"personName"`
	PersonIdCard string `xorm:"varchar(100)" json:"personIdCard"`
	PersonEmail  string `xorm:"varchar(100)" json:"personEmail"`
	PersonPhone  string `xorm:"varchar(100)" json:"personPhone"`
	// Invoice Info
	InvoiceType   string `xorm:"varchar(100)" json:"invoiceType"`
	InvoiceTitle  string `xorm:"varchar(100)" json:"invoiceTitle"`
	InvoiceTaxId  string `xorm:"varchar(100)" json:"invoiceTaxId"`
	InvoiceRemark string `xorm:"varchar(100)" json:"invoiceRemark"`
	InvoiceUrl    string `xorm:"varchar(255)" json:"invoiceUrl"`
	// Order Info
	Order      string `xorm:"varchar(100)" json:"order"` // Internal order name
	OrderObj   *Order `xorm:"-" json:"orderObj,omitempty"`
	OutOrderId string `xorm:"varchar(100)" json:"outOrderId"` // External payment provider's order ID
	PayUrl     string `xorm:"varchar(2000)" json:"payUrl"`
	SuccessUrl string `xorm:"varchar(2000)" json:"successUrl"` // `successUrl` is redirected from `payUrl` after pay success
	State      string `xorm:"varchar(100)" json:"state"`
	Message    string `xorm:"varchar(2000)" json:"message"`
}

func GetPaginationPayments

func GetPaginationPayments(p int, pageSize int, queryMap map[string]string) ([]*Payment, int, error)

func GetPayment

func GetPayment(name string) (*Payment, error)

func GetPayments

func GetPayments() ([]*Payment, error)

func GetUserPayments

func GetUserPayments(userName string) ([]*Payment, error)

func PayOrder

func PayOrder(orderName string, providerName string) (*Payment, error)

type Permission

type Permission struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Users   []string `xorm:"mediumtext" json:"users"`
	Groups  []string `xorm:"mediumtext" json:"groups"`
	Roles   []string `xorm:"mediumtext" json:"roles"`
	Domains []string `xorm:"mediumtext" json:"domains"`

	Model        string   `xorm:"varchar(100)" json:"model"`
	Adapter      string   `xorm:"varchar(100)" json:"adapter"`
	ResourceType string   `xorm:"varchar(100)" json:"resourceType"`
	Resources    []string `xorm:"mediumtext" json:"resources"`
	Actions      []string `xorm:"mediumtext" json:"actions"`
	Effect       string   `xorm:"varchar(100)" json:"effect"`
	IsEnabled    bool     `json:"isEnabled"`

	Submitter   string `xorm:"varchar(100)" json:"submitter"`
	Approver    string `xorm:"varchar(100)" json:"approver"`
	ApproveTime string `xorm:"varchar(100)" json:"approveTime"`
	State       string `xorm:"varchar(100)" json:"state"`
}

func GetPaginationPermissions

func GetPaginationPermissions(p int, pageSize int, queryMap map[string]string) ([]*Permission, int, error)

func GetPermission

func GetPermission(name string) (*Permission, error)

func GetPermissions

func GetPermissions() ([]*Permission, error)

func GetPermissionsByRole

func GetPermissionsByRole(name string) ([]*Permission, error)

type PermissionRule

type PermissionRule struct {
	Ptype string `xorm:"varchar(100) index not null default ''" json:"ptype"`
	V0    string `xorm:"varchar(100) index not null default ''" json:"v0"`
	V1    string `xorm:"varchar(100) index not null default ''" json:"v1"`
	V2    string `xorm:"varchar(100) index not null default ''" json:"v2"`
	V3    string `xorm:"varchar(100) index not null default ''" json:"v3"`
	V4    string `xorm:"varchar(100) index not null default ''" json:"v4"`
	V5    string `xorm:"varchar(100) index not null default ''" json:"v5"`
	Id    string `xorm:"varchar(100) index not null default ''" json:"id"`
}

type Plan

type Plan struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Price            float64  `json:"price"`
	Currency         string   `xorm:"varchar(100)" json:"currency"`
	Period           string   `xorm:"varchar(100)" json:"period"`
	Product          string   `xorm:"varchar(100)" json:"product"`
	PaymentProviders []string `xorm:"varchar(100)" json:"paymentProviders"` // payment providers for related product
	IsEnabled        bool     `json:"isEnabled"`

	Role    string   `xorm:"varchar(100)" json:"role"`
	Options []string `xorm:"-" json:"options"`
}

Plan has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/plan.go#L24

func GetPaginationPlans

func GetPaginationPlans(p int, pageSize int, queryMap map[string]string) ([]*Plan, int, error)

func GetPlan

func GetPlan(name string) (*Plan, error)

func GetPlans

func GetPlans() ([]*Plan, error)

type PolicyFilter

type PolicyFilter struct {
	Ptype       string   `json:"ptype"`
	FieldIndex  *int     `json:"fieldIndex,omitempty"`
	FieldValues []string `json:"fieldValues,omitempty"`
}

PolicyFilter represents a filter for getting policies

type Pricing

type Pricing struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Plans         []string `xorm:"mediumtext" json:"plans"`
	IsEnabled     bool     `json:"isEnabled"`
	TrialDuration int      `json:"trialDuration"`
	Application   string   `xorm:"varchar(100)" json:"application"`

	Submitter   string `xorm:"varchar(100)" json:"submitter"`
	Approver    string `xorm:"varchar(100)" json:"approver"`
	ApproveTime string `xorm:"varchar(100)" json:"approveTime"`

	State string `xorm:"varchar(100)" json:"state"`
}

Pricing has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/pricing.go#L24

func GetPaginationPricings

func GetPaginationPricings(p int, pageSize int, queryMap map[string]string) ([]*Pricing, int, error)

func GetPricing

func GetPricing(name string) (*Pricing, error)

func GetPricings

func GetPricings() ([]*Pricing, error)

type Product

type Product struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Image                 string    `xorm:"varchar(100)" json:"image"`
	Detail                string    `xorm:"varchar(1000)" json:"detail"`
	Description           string    `xorm:"varchar(200)" json:"description"`
	Tag                   string    `xorm:"varchar(100)" json:"tag"`
	Currency              string    `xorm:"varchar(100)" json:"currency"`
	Price                 float64   `json:"price"`
	Quantity              int       `json:"quantity"`
	Sold                  int       `json:"sold"`
	IsRecharge            bool      `json:"isRecharge"`
	RechargeOptions       []float64 `xorm:"varchar(500)" json:"rechargeOptions"`
	DisableCustomRecharge bool      `json:"disableCustomRecharge"`
	Providers             []string  `xorm:"varchar(255)" json:"providers"`
	SuccessUrl            string    `xorm:"varchar(1000)" json:"successUrl"`

	State string `xorm:"varchar(100)" json:"state"`

	ProviderObjs []*Provider `xorm:"-" json:"providerObjs"`
}

func GetPaginationProducts

func GetPaginationProducts(p int, pageSize int, queryMap map[string]string) ([]*Product, int, error)

func GetProduct

func GetProduct(name string) (*Product, error)

func GetProducts

func GetProducts() ([]*Product, error)

type ProductInfo

type ProductInfo struct {
	Owner       string  `json:"owner"`
	Name        string  `json:"name"`
	DisplayName string  `json:"displayName"`
	Image       string  `json:"image,omitempty"`
	Detail      string  `json:"detail,omitempty"`
	Price       float64 `json:"price"`
	Currency    string  `json:"currency,omitempty"`
	IsRecharge  bool    `json:"isRecharge,omitempty"`
	Quantity    int     `json:"quantity,omitempty"`
	PricingName string  `json:"pricingName,omitempty"`
	PlanName    string  `json:"planName,omitempty"`
}

type Provider

type Provider struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk unique" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	DisplayName       string            `xorm:"varchar(100)" json:"displayName"`
	Category          string            `xorm:"varchar(100)" json:"category"`
	Type              string            `xorm:"varchar(100)" json:"type"`
	SubType           string            `xorm:"varchar(100)" json:"subType"`
	Method            string            `xorm:"varchar(100)" json:"method"`
	ClientId          string            `xorm:"varchar(100)" json:"clientId"`
	ClientSecret      string            `xorm:"varchar(2000)" json:"clientSecret"`
	ClientId2         string            `xorm:"varchar(100)" json:"clientId2"`
	ClientSecret2     string            `xorm:"varchar(100)" json:"clientSecret2"`
	Cert              string            `xorm:"varchar(100)" json:"cert"`
	CustomAuthUrl     string            `xorm:"varchar(200)" json:"customAuthUrl"`
	CustomTokenUrl    string            `xorm:"varchar(200)" json:"customTokenUrl"`
	CustomUserInfoUrl string            `xorm:"varchar(200)" json:"customUserInfoUrl"`
	Scopes            string            `xorm:"varchar(100)" json:"scopes"`
	UserMapping       map[string]string `xorm:"varchar(500)" json:"userMapping"`

	Host       string `xorm:"varchar(100)" json:"host"`
	Port       int    `json:"port"`
	DisableSsl bool   `json:"disableSsl"` // If the provider type is WeChat, DisableSsl means EnableQRCode
	Title      string `xorm:"varchar(100)" json:"title"`
	Content    string `xorm:"varchar(1000)" json:"content"` // If provider type is WeChat, Content means QRCode string by Base64 encoding
	Receiver   string `xorm:"varchar(100)" json:"receiver"`

	RegionId     string `xorm:"varchar(100)" json:"regionId"`
	SignName     string `xorm:"varchar(100)" json:"signName"`
	TemplateCode string `xorm:"varchar(100)" json:"templateCode"`
	AppId        string `xorm:"varchar(100)" json:"appId"`

	Endpoint         string `xorm:"varchar(1000)" json:"endpoint"`
	IntranetEndpoint string `xorm:"varchar(100)" json:"intranetEndpoint"`
	Domain           string `xorm:"varchar(100)" json:"domain"`
	Bucket           string `xorm:"varchar(100)" json:"bucket"`
	PathPrefix       string `xorm:"varchar(100)" json:"pathPrefix"`

	Metadata               string `xorm:"mediumtext" json:"metadata"`
	IdP                    string `xorm:"mediumtext" json:"idP"`
	IssuerUrl              string `xorm:"varchar(100)" json:"issuerUrl"`
	EnableSignAuthnRequest bool   `json:"enableSignAuthnRequest"`

	ProviderUrl string `xorm:"varchar(200)" json:"providerUrl"`
}

func GetPaginationProviders

func GetPaginationProviders(p int, pageSize int, queryMap map[string]string) ([]*Provider, int, error)

func GetProvider

func GetProvider(name string) (*Provider, error)

func GetProviders

func GetProviders() ([]*Provider, error)

type ProviderItem

type ProviderItem struct {
	Owner string `json:"owner"`
	Name  string `json:"name"`

	CanSignUp bool      `json:"canSignUp"`
	CanSignIn bool      `json:"canSignIn"`
	CanUnlink bool      `json:"canUnlink"`
	Prompted  bool      `json:"prompted"`
	AlertType string    `json:"alertType"`
	Rule      string    `json:"rule"`
	Provider  *Provider `json:"provider"`
}

type Record

type Record struct {
	Id int `xorm:"int notnull pk autoincr" json:"id"`

	Owner       string `xorm:"varchar(100) index" json:"owner"`
	Name        string `xorm:"varchar(100) index" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Organization string `xorm:"varchar(100)" json:"organization"`
	ClientIp     string `xorm:"varchar(100)" json:"clientIp"`
	User         string `xorm:"varchar(100)" json:"user"`
	Method       string `xorm:"varchar(100)" json:"method"`
	RequestUri   string `xorm:"varchar(1000)" json:"requestUri"`
	Action       string `xorm:"varchar(1000)" json:"action"`
	Language     string `xorm:"varchar(100)" json:"language"`

	StatusCode int    `json:"statusCode"`
	Response   string `xorm:"mediumtext" json:"response"`
	Object     string `xorm:"mediumtext" json:"object"`

	IsTriggered bool `json:"isTriggered"`
}

func GetPaginationRecords

func GetPaginationRecords(p int, pageSize int, queryMap map[string]string) ([]*Record, int, error)

func GetRecord

func GetRecord(name string) (*Record, error)

func GetRecords

func GetRecords() ([]*Record, error)

type Resource

type Resource struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(180) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	User        string `xorm:"varchar(100)" json:"user"`
	Provider    string `xorm:"varchar(100)" json:"provider"`
	Application string `xorm:"varchar(100)" json:"application"`
	Tag         string `xorm:"varchar(100)" json:"tag"`
	Parent      string `xorm:"varchar(100)" json:"parent"`
	FileName    string `xorm:"varchar(255)" json:"fileName"`
	FileType    string `xorm:"varchar(100)" json:"fileType"`
	FileFormat  string `xorm:"varchar(100)" json:"fileFormat"`
	FileSize    int    `json:"fileSize"`
	Url         string `xorm:"varchar(255)" json:"url"`
	Description string `xorm:"varchar(255)" json:"description"`
}

Resource has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/resource.go#L24

func GetPaginationResources

func GetPaginationResources(owner, user, field, value string, pageSize, page int, sortField, sortOrder string) ([]*Resource, error)

func GetResource

func GetResource(id string) (*Resource, error)

func GetResourceEx

func GetResourceEx(owner, name string) (*Resource, error)

func GetResources

func GetResources(owner, user, field, value, sortField, sortOrder string) ([]*Resource, error)

type Response

type Response struct {
	Status string      `json:"status"`
	Msg    string      `json:"msg"`
	Data   interface{} `json:"data"`
	Data2  interface{} `json:"data2"`
}

func DoGetResponse

func DoGetResponse(url string) (*Response, error)

DoGetResponse is a general function to get response from param url through HTTP Get method.

func DoPost

func DoPost(action string, queryMap map[string]string, postBytes []byte, isForm, isFile bool) (*Response, error)

type Role

type Role struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Users     []string `xorm:"mediumtext" json:"users"`
	Groups    []string `xorm:"mediumtext" json:"groups"`
	Roles     []string `xorm:"mediumtext" json:"roles"`
	Domains   []string `xorm:"mediumtext" json:"domains"`
	IsEnabled bool     `json:"isEnabled"`
}

Role has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/role.go#L24

func GetPaginationRoles

func GetPaginationRoles(p int, pageSize int, queryMap map[string]string) ([]*Role, int, error)

func GetRole

func GetRole(name string) (*Role, error)

func GetRoles

func GetRoles() ([]*Role, error)

type SamlItem

type SamlItem struct {
	Name       string `json:"name"`
	NameFormat string `json:"nameFormat"`
	Value      string `json:"value"`
}

type Session

type Session struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	Application string `xorm:"varchar(100) notnull pk" json:"application"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	SessionId []string `json:"sessionId"`
}

func GetPaginationSessions

func GetPaginationSessions(p int, pageSize int, queryMap map[string]string) ([]*Session, int, error)

func GetSession

func GetSession(name string, application string) (*Session, error)

func GetSessions

func GetSessions() ([]*Session, error)

type SigninItem

type SigninItem struct {
	Name        string `json:"name"`
	Visible     bool   `json:"visible"`
	Label       string `json:"label"`
	CustomCss   string `json:"customCss"`
	Placeholder string `json:"placeholder"`
	Rule        string `json:"rule"`
	IsCustom    bool   `json:"isCustom"`
}

type SigninMethod

type SigninMethod struct {
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Rule        string `json:"rule"`
}

type SignupItem

type SignupItem struct {
	Name        string   `json:"name"`
	Visible     bool     `json:"visible"`
	Required    bool     `json:"required"`
	Prompted    bool     `json:"prompted"`
	Type        string   `json:"type"`
	CustomCss   string   `json:"customCss"`
	Label       string   `json:"label"`
	Placeholder string   `json:"placeholder"`
	Options     []string `json:"options"`
	Regex       string   `json:"regex"`
	Rule        string   `json:"rule"`
}

type Subscription

type Subscription struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	Description string `xorm:"varchar(100)" json:"description"`

	User    string `xorm:"varchar(100)" json:"user"`
	Pricing string `xorm:"varchar(100)" json:"pricing"`
	Plan    string `xorm:"varchar(100)" json:"plan"`
	Payment string `xorm:"varchar(100)" json:"payment"`

	StartTime string            `xorm:"varchar(100)" json:"startTime"`
	EndTime   string            `xorm:"varchar(100)" json:"endTime"`
	Period    string            `xorm:"varchar(100)" json:"period"`
	State     SubscriptionState `xorm:"varchar(100)" json:"state"`
}

Subscription has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/subscription.go#L39

func GetPaginationSubscriptions

func GetPaginationSubscriptions(p int, pageSize int, queryMap map[string]string) ([]*Subscription, int, error)

func GetSubscription

func GetSubscription(name string) (*Subscription, error)

func GetSubscriptions

func GetSubscriptions() ([]*Subscription, error)

type SubscriptionState

type SubscriptionState string
const (
	SubStatePending   SubscriptionState = "Pending"
	SubStateError     SubscriptionState = "Error"
	SubStateSuspended SubscriptionState = "Suspended" // suspended by the admin

	SubStateActive   SubscriptionState = "Active"
	SubStateUpcoming SubscriptionState = "Upcoming"
	SubStateExpired  SubscriptionState = "Expired"
)

type SyncLdapUsersResponse

type SyncLdapUsersResponse struct {
	Exist  []*LdapUser `json:"exist"`
	Failed []*LdapUser `json:"failed"`
}

func SyncLdapUsers

func SyncLdapUsers(id string, users []*LdapUser) (*SyncLdapUsersResponse, error)

func SyncLdapUsersFromServer

func SyncLdapUsersFromServer(id string) (*SyncLdapUsersResponse, error)

type Syncer

type Syncer struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Organization string `xorm:"varchar(100)" json:"organization"`
	Type         string `xorm:"varchar(100)" json:"type"`

	Host             string         `xorm:"varchar(100)" json:"host"`
	Port             int            `json:"port"`
	User             string         `xorm:"varchar(100)" json:"user"`
	Password         string         `xorm:"varchar(100)" json:"password"`
	DatabaseType     string         `xorm:"varchar(100)" json:"databaseType"`
	Database         string         `xorm:"varchar(100)" json:"database"`
	Table            string         `xorm:"varchar(100)" json:"table"`
	TablePrimaryKey  string         `xorm:"varchar(100)" json:"tablePrimaryKey"`
	TableColumns     []*TableColumn `xorm:"mediumtext" json:"tableColumns"`
	AffiliationTable string         `xorm:"varchar(100)" json:"affiliationTable"`
	AvatarBaseUrl    string         `xorm:"varchar(100)" json:"avatarBaseUrl"`
	ErrorText        string         `xorm:"mediumtext" json:"errorText"`
	SyncInterval     int            `json:"syncInterval"`
	IsReadOnly       bool           `json:"isReadOnly"`
	IsEnabled        bool           `json:"isEnabled"`
}

Syncer has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/syncer.go#L24

func GetPaginationSyncers

func GetPaginationSyncers(p int, pageSize int, queryMap map[string]string) ([]*Syncer, int, error)

func GetSyncer

func GetSyncer(name string) (*Syncer, error)

func GetSyncers

func GetSyncers() ([]*Syncer, error)

type TableColumn

type TableColumn struct {
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	CasdoorName string   `json:"casdoorName"`
	IsKey       bool     `json:"isKey"`
	IsHashed    bool     `json:"isHashed"`
	Values      []string `json:"values"`
}

type ThemeData

type ThemeData struct {
	ThemeType    string `xorm:"varchar(30)" json:"themeType"`
	ColorPrimary string `xorm:"varchar(10)" json:"colorPrimary"`
	BorderRadius int    `xorm:"int" json:"borderRadius"`
	IsCompact    bool   `xorm:"bool" json:"isCompact"`
	IsEnabled    bool   `xorm:"bool" json:"isEnabled"`
}

type Token

type Token struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Application  string `xorm:"varchar(100)" json:"application"`
	Organization string `xorm:"varchar(100)" json:"organization"`
	User         string `xorm:"varchar(100)" json:"user"`

	Code             string `xorm:"varchar(100) index" json:"code"`
	AccessToken      string `xorm:"mediumtext" json:"accessToken"`
	RefreshToken     string `xorm:"mediumtext" json:"refreshToken"`
	AccessTokenHash  string `xorm:"varchar(100) index" json:"accessTokenHash"`
	RefreshTokenHash string `xorm:"varchar(100) index" json:"refreshTokenHash"`
	ExpiresIn        int    `json:"expiresIn"`
	Scope            string `xorm:"varchar(100)" json:"scope"`
	TokenType        string `xorm:"varchar(100)" json:"tokenType"`
	CodeChallenge    string `xorm:"varchar(100)" json:"codeChallenge"`
	CodeIsUsed       bool   `json:"codeIsUsed"`
	CodeExpireIn     int64  `json:"codeExpireIn"`
}

Token has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/token.go#L45

func GetPaginationTokens

func GetPaginationTokens(p int, pageSize int, queryMap map[string]string) ([]*Token, int, error)

func GetToken

func GetToken(name string) (*Token, error)

func GetTokens

func GetTokens() ([]*Token, error)

type Transaction

type Transaction struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Application string `xorm:"varchar(100)" json:"application"`
	Domain      string `xorm:"varchar(1000)" json:"domain"`
	Category    string `xorm:"varchar(100)" json:"category"`
	Type        string `xorm:"varchar(100)" json:"type"`
	Subtype     string `xorm:"varchar(100)" json:"subtype"`
	Provider    string `xorm:"varchar(100)" json:"provider"`
	User        string `xorm:"varchar(100)" json:"user"`
	Tag         string `xorm:"varchar(100)" json:"tag"`

	Amount   float64 `json:"amount"`
	Currency string  `xorm:"varchar(100)" json:"currency"`

	Payment string `xorm:"varchar(100)" json:"payment"`

	State string `xorm:"varchar(100)" json:"state"`
}

Transaction has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/transaction.go#L24

func GetPaginationTransactions

func GetPaginationTransactions(p int, pageSize int, queryMap map[string]string) ([]*Transaction, int, error)

func GetTransaction

func GetTransaction(name string) (*Transaction, error)

func GetTransactions

func GetTransactions() ([]*Transaction, error)

func GetUserTransactions

func GetUserTransactions(userName string) ([]*Transaction, error)

type User

type User struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(255) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100) index" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
	DeletedTime string `xorm:"varchar(100)" json:"deletedTime"`

	Id                   string     `xorm:"varchar(100) index" json:"id"`
	ExternalId           string     `xorm:"varchar(100) index" json:"externalId"`
	Type                 string     `xorm:"varchar(100)" json:"type"`
	Password             string     `xorm:"varchar(150)" json:"password"`
	PasswordSalt         string     `xorm:"varchar(100)" json:"passwordSalt"`
	PasswordType         string     `xorm:"varchar(100)" json:"passwordType"`
	DisplayName          string     `xorm:"varchar(100)" json:"displayName"`
	FirstName            string     `xorm:"varchar(100)" json:"firstName"`
	LastName             string     `xorm:"varchar(100)" json:"lastName"`
	Avatar               string     `xorm:"text" json:"avatar"`
	AvatarType           string     `xorm:"varchar(100)" json:"avatarType"`
	PermanentAvatar      string     `xorm:"varchar(500)" json:"permanentAvatar"`
	Email                string     `xorm:"varchar(100) index" json:"email"`
	EmailVerified        bool       `json:"emailVerified"`
	Phone                string     `xorm:"varchar(100) index" json:"phone"`
	CountryCode          string     `xorm:"varchar(6)" json:"countryCode"`
	Region               string     `xorm:"varchar(100)" json:"region"`
	Location             string     `xorm:"varchar(100)" json:"location"`
	Address              []string   `json:"address"`
	Addresses            []*Address `xorm:"addresses blob" json:"addresses"`
	Affiliation          string     `xorm:"varchar(100)" json:"affiliation"`
	Title                string     `xorm:"varchar(100)" json:"title"`
	IdCardType           string     `xorm:"varchar(100)" json:"idCardType"`
	IdCard               string     `xorm:"varchar(100) index" json:"idCard"`
	RealName             string     `xorm:"varchar(100)" json:"realName"`
	IsVerified           bool       `json:"isVerified"`
	Homepage             string     `xorm:"varchar(100)" json:"homepage"`
	Bio                  string     `xorm:"varchar(100)" json:"bio"`
	Tag                  string     `xorm:"varchar(100)" json:"tag"`
	Language             string     `xorm:"varchar(100)" json:"language"`
	Gender               string     `xorm:"varchar(100)" json:"gender"`
	Birthday             string     `xorm:"varchar(100)" json:"birthday"`
	Education            string     `xorm:"varchar(100)" json:"education"`
	Score                int        `json:"score"`
	Karma                int        `json:"karma"`
	Ranking              int        `json:"ranking"`
	Balance              float64    `json:"balance"`
	BalanceCredit        float64    `json:"balanceCredit"`
	Currency             string     `xorm:"varchar(100)" json:"currency"`
	BalanceCurrency      string     `xorm:"varchar(100)" json:"balanceCurrency"`
	IsDefaultAvatar      bool       `json:"isDefaultAvatar"`
	IsOnline             bool       `json:"isOnline"`
	IsAdmin              bool       `json:"isAdmin"`
	IsForbidden          bool       `json:"isForbidden"`
	IsDeleted            bool       `json:"isDeleted"`
	SignupApplication    string     `xorm:"varchar(100)" json:"signupApplication"`
	Hash                 string     `xorm:"varchar(100)" json:"hash"`
	PreHash              string     `xorm:"varchar(100)" json:"preHash"`
	RegisterType         string     `xorm:"varchar(100)" json:"registerType"`
	RegisterSource       string     `xorm:"varchar(100)" json:"registerSource"`
	AccessKey            string     `xorm:"varchar(100)" json:"accessKey"`
	AccessSecret         string     `xorm:"varchar(100)" json:"accessSecret"`
	AccessToken          string     `xorm:"mediumtext" json:"accessToken"`
	OriginalToken        string     `xorm:"mediumtext" json:"originalToken"`
	OriginalRefreshToken string     `xorm:"mediumtext" json:"originalRefreshToken"`

	CreatedIp      string `xorm:"varchar(100)" json:"createdIp"`
	LastSigninTime string `xorm:"varchar(100)" json:"lastSigninTime"`
	LastSigninIp   string `xorm:"varchar(100)" json:"lastSigninIp"`

	GitHub          string `xorm:"github varchar(100)" json:"github"`
	Google          string `xorm:"varchar(100)" json:"google"`
	QQ              string `xorm:"qq varchar(100)" json:"qq"`
	WeChat          string `xorm:"wechat varchar(100)" json:"wechat"`
	Facebook        string `xorm:"facebook varchar(100)" json:"facebook"`
	DingTalk        string `xorm:"dingtalk varchar(100)" json:"dingtalk"`
	Weibo           string `xorm:"weibo varchar(100)" json:"weibo"`
	Gitee           string `xorm:"gitee varchar(100)" json:"gitee"`
	LinkedIn        string `xorm:"linkedin varchar(100)" json:"linkedin"`
	Wecom           string `xorm:"wecom varchar(100)" json:"wecom"`
	Lark            string `xorm:"lark varchar(100)" json:"lark"`
	Gitlab          string `xorm:"gitlab varchar(100)" json:"gitlab"`
	Adfs            string `xorm:"adfs varchar(100)" json:"adfs"`
	Baidu           string `xorm:"baidu varchar(100)" json:"baidu"`
	Alipay          string `xorm:"alipay varchar(100)" json:"alipay"`
	Infoflow        string `xorm:"infoflow varchar(100)" json:"infoflow"`
	Apple           string `xorm:"apple varchar(100)" json:"apple"`
	AzureAD         string `xorm:"azuread varchar(100)" json:"azuread"`
	AzureADB2c      string `xorm:"azureadb2c varchar(100)" json:"azureadb2c"`
	Slack           string `xorm:"slack varchar(100)" json:"slack"`
	Steam           string `xorm:"steam varchar(100)" json:"steam"`
	Bilibili        string `xorm:"bilibili varchar(100)" json:"bilibili"`
	Okta            string `xorm:"okta varchar(100)" json:"okta"`
	Douyin          string `xorm:"douyin varchar(100)" json:"douyin"`
	Kwai            string `xorm:"kwai varchar(100)" json:"kwai"`
	Line            string `xorm:"line varchar(100)" json:"line"`
	Amazon          string `xorm:"amazon varchar(100)" json:"amazon"`
	Auth0           string `xorm:"auth0 varchar(100)" json:"auth0"`
	BattleNet       string `xorm:"battlenet varchar(100)" json:"battlenet"`
	Bitbucket       string `xorm:"bitbucket varchar(100)" json:"bitbucket"`
	Box             string `xorm:"box varchar(100)" json:"box"`
	CloudFoundry    string `xorm:"cloudfoundry varchar(100)" json:"cloudfoundry"`
	Dailymotion     string `xorm:"dailymotion varchar(100)" json:"dailymotion"`
	Deezer          string `xorm:"deezer varchar(100)" json:"deezer"`
	DigitalOcean    string `xorm:"digitalocean varchar(100)" json:"digitalocean"`
	Discord         string `xorm:"discord varchar(100)" json:"discord"`
	Dropbox         string `xorm:"dropbox varchar(100)" json:"dropbox"`
	EveOnline       string `xorm:"eveonline varchar(100)" json:"eveonline"`
	Fitbit          string `xorm:"fitbit varchar(100)" json:"fitbit"`
	Gitea           string `xorm:"gitea varchar(100)" json:"gitea"`
	Heroku          string `xorm:"heroku varchar(100)" json:"heroku"`
	InfluxCloud     string `xorm:"influxcloud varchar(100)" json:"influxcloud"`
	Instagram       string `xorm:"instagram varchar(100)" json:"instagram"`
	Intercom        string `xorm:"intercom varchar(100)" json:"intercom"`
	Kakao           string `xorm:"kakao varchar(100)" json:"kakao"`
	Lastfm          string `xorm:"lastfm varchar(100)" json:"lastfm"`
	Mailru          string `xorm:"mailru varchar(100)" json:"mailru"`
	Meetup          string `xorm:"meetup varchar(100)" json:"meetup"`
	MicrosoftOnline string `xorm:"microsoftonline varchar(100)" json:"microsoftonline"`
	Naver           string `xorm:"naver varchar(100)" json:"naver"`
	Nextcloud       string `xorm:"nextcloud varchar(100)" json:"nextcloud"`
	OneDrive        string `xorm:"onedrive varchar(100)" json:"onedrive"`
	Oura            string `xorm:"oura varchar(100)" json:"oura"`
	Patreon         string `xorm:"patreon varchar(100)" json:"patreon"`
	Paypal          string `xorm:"paypal varchar(100)" json:"paypal"`
	SalesForce      string `xorm:"salesforce varchar(100)" json:"salesforce"`
	Shopify         string `xorm:"shopify varchar(100)" json:"shopify"`
	Soundcloud      string `xorm:"soundcloud varchar(100)" json:"soundcloud"`
	Spotify         string `xorm:"spotify varchar(100)" json:"spotify"`
	Strava          string `xorm:"strava varchar(100)" json:"strava"`
	Stripe          string `xorm:"stripe varchar(100)" json:"stripe"`
	TikTok          string `xorm:"tiktok varchar(100)" json:"tiktok"`
	Tumblr          string `xorm:"tumblr varchar(100)" json:"tumblr"`
	Twitch          string `xorm:"twitch varchar(100)" json:"twitch"`
	Twitter         string `xorm:"twitter varchar(100)" json:"twitter"`
	Typetalk        string `xorm:"typetalk varchar(100)" json:"typetalk"`
	Uber            string `xorm:"uber varchar(100)" json:"uber"`
	VK              string `xorm:"vk varchar(100)" json:"vk"`
	Wepay           string `xorm:"wepay varchar(100)" json:"wepay"`
	Xero            string `xorm:"xero varchar(100)" json:"xero"`
	Yahoo           string `xorm:"yahoo varchar(100)" json:"yahoo"`
	Yammer          string `xorm:"yammer varchar(100)" json:"yammer"`
	Yandex          string `xorm:"yandex varchar(100)" json:"yandex"`
	Zoom            string `xorm:"zoom varchar(100)" json:"zoom"`
	MetaMask        string `xorm:"metamask varchar(100)" json:"metamask"`
	Web3Onboard     string `xorm:"web3onboard varchar(100)" json:"web3onboard"`
	Custom          string `xorm:"custom varchar(100)" json:"custom"`
	Custom2         string `xorm:"custom2 text" json:"custom2"`
	Custom3         string `xorm:"custom3 text" json:"custom3"`
	Custom4         string `xorm:"custom4 text" json:"custom4"`
	Custom5         string `xorm:"custom5 text" json:"custom5"`
	Custom6         string `xorm:"custom6 text" json:"custom6"`
	Custom7         string `xorm:"custom7 text" json:"custom7"`
	Custom8         string `xorm:"custom8 text" json:"custom8"`
	Custom9         string `xorm:"custom9 text" json:"custom9"`
	Custom10        string `xorm:"custom10 text" json:"custom10"`

	// WebauthnCredentials []webauthn.Credential `xorm:"webauthnCredentials blob" json:"webauthnCredentials"`
	PreferredMfaType  string        `xorm:"varchar(100)" json:"preferredMfaType"`
	RecoveryCodes     []string      `xorm:"mediumtext" json:"recoveryCodes"`
	TotpSecret        string        `xorm:"varchar(100)" json:"totpSecret"`
	MfaPhoneEnabled   bool          `json:"mfaPhoneEnabled"`
	MfaEmailEnabled   bool          `json:"mfaEmailEnabled"`
	MfaRadiusEnabled  bool          `json:"mfaRadiusEnabled"`
	MfaRadiusUsername string        `xorm:"varchar(100)" json:"mfaRadiusUsername"`
	MfaRadiusProvider string        `xorm:"varchar(100)" json:"mfaRadiusProvider"`
	MfaPushEnabled    bool          `json:"mfaPushEnabled"`
	MfaPushReceiver   string        `xorm:"varchar(100)" json:"mfaPushReceiver"`
	MfaPushProvider   string        `xorm:"varchar(100)" json:"mfaPushProvider"`
	MultiFactorAuths  []*MfaProps   `xorm:"-" json:"multiFactorAuths,omitempty"`
	Invitation        string        `xorm:"varchar(100) index" json:"invitation"`
	InvitationCode    string        `xorm:"varchar(100) index" json:"invitationCode"`
	FaceIds           []*FaceId     `json:"faceIds"`
	Cart              []ProductInfo `xorm:"mediumtext" json:"cart"`

	Ldap       string            `xorm:"ldap varchar(100)" json:"ldap"`
	Properties map[string]string `json:"properties"`

	Roles       []*Role       `json:"roles"`
	Permissions []*Permission `json:"permissions"`
	Groups      []string      `xorm:"mediumtext" json:"groups"`

	LastChangePasswordTime string `xorm:"varchar(100)" json:"lastChangePasswordTime"`
	LastSigninWrongTime    string `xorm:"varchar(100)" json:"lastSigninWrongTime"`
	SigninWrongTimes       int    `json:"signinWrongTimes"`

	ManagedAccounts     []ManagedAccount `xorm:"managedAccounts blob" json:"managedAccounts"`
	MfaAccounts         []MfaAccount     `xorm:"mfaAccounts blob" json:"mfaAccounts"`
	MfaItems            []*MfaItem       `xorm:"varchar(300)" json:"mfaItems"`
	MfaRememberDeadline string           `xorm:"varchar(100)" json:"mfaRememberDeadline"`
	NeedUpdatePassword  bool             `json:"needUpdatePassword"`
	IpWhitelist         string           `xorm:"varchar(200)" json:"ipWhitelist"`
}

User has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/user.go#L24

func GetGlobalUsers

func GetGlobalUsers() ([]*User, error)

func GetPaginationUsers

func GetPaginationUsers(p int, pageSize int, queryMap map[string]string) ([]*User, int, error)

func GetSortedUsers

func GetSortedUsers(sorter string, limit int) ([]*User, error)

func GetUser

func GetUser(name string) (*User, error)

func GetUserByEmail

func GetUserByEmail(email string) (*User, error)

func GetUserByPhone

func GetUserByPhone(phone string) (*User, error)

func GetUserByUserId

func GetUserByUserId(userId string) (*User, error)

func GetUsers

func GetUsers() ([]*User, error)

func (User) GetId

func (u User) GetId() string

type Userinfo

type Userinfo struct {
	Sub           string   `json:"sub"`
	Iss           string   `json:"iss"`
	Aud           string   `json:"aud"`
	Name          string   `json:"preferred_username,omitempty"`
	DisplayName   string   `json:"name,omitempty"`
	Email         string   `json:"email,omitempty"`
	EmailVerified bool     `json:"email_verified,omitempty"`
	Avatar        string   `json:"picture,omitempty"`
	Address       string   `json:"address,omitempty"`
	Phone         string   `json:"phone,omitempty"`
	RealName      string   `json:"real_name,omitempty"`
	IsVerified    bool     `json:"is_verified,omitempty"`
	Groups        []string `json:"groups,omitempty"`
	Roles         []string `json:"roles,omitempty"`
	Permissions   []string `json:"permissions,omitempty"`
}

type Webhook

type Webhook struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Organization string `xorm:"varchar(100) index" json:"organization"`

	Url            string    `xorm:"varchar(200)" json:"url"`
	Method         string    `xorm:"varchar(100)" json:"method"`
	ContentType    string    `xorm:"varchar(100)" json:"contentType"`
	Headers        []*Header `xorm:"mediumtext" json:"headers"`
	Events         []string  `xorm:"varchar(1000)" json:"events"`
	TokenFields    []string  `xorm:"varchar(1000)" json:"tokenFields"`
	ObjectFields   []string  `xorm:"varchar(1000)" json:"objectFields"`
	IsUserExtended bool      `json:"isUserExtended"`
	SingleOrgOnly  bool      `json:"singleOrgOnly"`
	IsEnabled      bool      `json:"isEnabled"`
}

Webhook has the same definition as https://github.com/hanzo-iam/hanzo-iam/blob/master/object/webhook.go#L30

func GetPaginationWebhooks

func GetPaginationWebhooks(p int, pageSize int, queryMap map[string]string) ([]*Webhook, int, error)

func GetWebhook

func GetWebhook(name string) (*Webhook, error)

func GetWebhooks

func GetWebhooks() ([]*Webhook, error)

Directories

Path Synopsis
cmd
iam command
Command iam is the administrative CLI for Hanzo IAM.
Command iam is the administrative CLI for Hanzo IAM.
iam/cli
Package cli is the cobra command surface for the `iam` administrative CLI.
Package cli is the cobra command surface for the `iam` administrative CLI.
iamctl command
Command iamctl is the operational CLI for Hanzo IAM.
Command iamctl is the operational CLI for Hanzo IAM.
iamd command
Command iamd is the IAM server daemon.
Command iamd is the IAM server daemon.
Package iamserver exports the IAM Beego server startup logic.
Package iamserver exports the IAM Beego server startup logic.
Package kms wraps the native-ZAP base/plugins/kms client for IAM.
Package kms wraps the native-ZAP base/plugins/kms client for IAM.
pkg
iam module
Package routers @APIVersion 1.503.0 @Title IAM RESTful API @Description Swagger Docs of IAM Backend API @Contact support@hanzo.ai @SecurityDefinition AccessToken apiKey Authorization header @Schemes https,http @ExternalDocs Find out more about IAM @ExternalDocsUrl https://github.com/hanzoai/iam
Package routers @APIVersion 1.503.0 @Title IAM RESTful API @Description Swagger Docs of IAM Backend API @Contact support@hanzo.ai @SecurityDefinition AccessToken apiKey Authorization header @Schemes https,http @ExternalDocs Find out more about IAM @ExternalDocsUrl https://github.com/hanzoai/iam
Package ui embeds the IAM admin dashboard built with Vite + React.
Package ui embeds the IAM admin dashboard built with Vite + React.

Jump to

Keyboard shortcuts

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