object

package
v1.381.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: Apache-2.0 Imports: 88 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SigninWrongTimesLimit     = 5
	LastSignWrongTimeDuration = time.Minute * 15
)
View Source
const (
	EmailType = "email"
	SmsType   = "sms"
	TotpType  = "app"
)
View Source
const (
	MfaSessionUserId = "MfaSessionUserId"
	NextMfa          = "NextMfa"
	RequiredMfa      = "RequiredMfa"
)
View Source
const (
	MfaCountryCodeSession = "mfa_country_code"
	MfaDestSession        = "mfa_dest"
)
View Source
const (
	InvalidRequest       = "invalid_request"
	InvalidClient        = "invalid_client"
	InvalidGrant         = "invalid_grant"
	UnauthorizedClient   = "unauthorized_client"
	UnsupportedGrantType = "unsupported_grant_type"
	InvalidScope         = "invalid_scope"
	EndpointError        = "endpoint_error"
)
View Source
const (
	UserPropertiesWechatUnionId = "wechatUnionId"
	UserPropertiesWechatOpenId  = "wechatOpenId"
)
View Source
const (
	VerifyTypePhone = "phone"
	VerifyTypeEmail = "email"
)
View Source
const MfaRecoveryCodesSession = "mfa_recovery_codes"
View Source
const MfaTotpSecretSession = "mfa_totp_secret"
View Source
const (
	VerificationSuccess = iota
)

Variables

View Source
var (
	ApiThroughput = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "casdoor_api_throughput",
		Help: "The throughput of each api access",
	}, []string{"path", "method"})

	ApiLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name: "casdoor_api_latency",
		Help: "API processing latency in milliseconds",
	}, []string{"path", "method"})

	CpuUsage = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "casdoor_cpu_usage",
		Help: "Casdoor cpu usage",
	}, []string{"cpuNum"})

	MemoryUsage = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "casdoor_memory_usage",
		Help: "Casdoor memory usage in Byte",
	}, []string{"type"})

	TotalThroughput = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "casdoor_total_throughput",
		Help: "The total throughput of casdoor",
	})
)
View Source
var (
	CasdoorApplication  = "app-built-in"
	CasdoorOrganization = "built-in"
)

Functions

func AddAdapter added in v1.377.0

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

func AddApplication

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

func AddCert

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

func AddEnforcer added in v1.374.0

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

func AddGroup added in v1.335.0

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

func AddGroups added in v1.335.0

func AddGroups(groups []*Group) (bool, error)

func AddLdap

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

func AddModel added in v1.54.0

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

func AddOrUpdateResource

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

func AddOrganization

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

func AddPayment added in v1.16.0

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

func AddPermission

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

func AddPermissions added in v1.325.0

func AddPermissions(permissions []*Permission) bool

func AddPermissionsInBatch added in v1.325.0

func AddPermissionsInBatch(permissions []*Permission) bool

func AddPlan added in v1.320.0

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

func AddPolicy added in v1.166.0

func AddPolicy(policy []string, adapter *Adapter) (bool, error)

func AddPricing added in v1.320.0

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

func AddProduct added in v1.23.0

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

func AddProvider

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

func AddRecord

func AddRecord(record *Record) bool

func AddResource

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

func AddRole

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

func AddRoles added in v1.325.0

func AddRoles(roles []*Role) bool

func AddRolesInBatch added in v1.325.0

func AddRolesInBatch(roles []*Role) bool

func AddSession added in v1.239.0

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

func AddSubscription added in v1.320.0

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

func AddSyncer

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

func AddToVerificationRecord

func AddToVerificationRecord(user *User, provider *Provider, remoteAddr, recordType, dest, code string) error

func AddToken

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

func AddUser

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

func AddUserToOriginalDatabase

func AddUserToOriginalDatabase(user *User) error

func AddUserkeys added in v1.337.0

func AddUserkeys(user *User, isAdmin bool) (bool, error)

func AddUsers

func AddUsers(users []*User) (bool, error)

func AddUsersInBatch

func AddUsersInBatch(users []*User) (bool, error)

func AddWebhook

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

func BatchEnforce added in v1.83.0

func BatchEnforce(permission *Permission, requests *[]CasbinRequest, permissionIds ...string) ([]bool, error)

func BuyProduct added in v1.27.6

func BuyProduct(id string, providerName string, user *User, host string) (string, string, error)

func CheckAccessPermission added in v1.70.0

func CheckAccessPermission(userId string, application *Application) (bool, error)

func CheckAccountItemModifyRule added in v1.77.1

func CheckAccountItemModifyRule(accountItem *AccountItem, isAdmin bool, lang string) (bool, string)

func CheckCasRestrict added in v1.371.0

func CheckCasRestrict(application *Application, lang string, service string) error

func CheckLdapExist

func CheckLdapExist(ldap *Ldap) (bool, error)

func CheckPassword

func CheckPassword(user *User, password string, lang string, options ...bool) string

func CheckPasswordComplexity added in v1.341.0

func CheckPasswordComplexity(user *User, password string) string

func CheckPasswordComplexityByOrg added in v1.341.0

func CheckPasswordComplexityByOrg(organization *Organization, password string) string

func CheckPermissionForUpdateUser added in v1.304.0

func CheckPermissionForUpdateUser(oldUser, newUser *User, isAdmin bool, lang string) (bool, string)

func CheckSigninCode added in v1.208.0

func CheckSigninCode(user *User, dest, code, lang string) string

func CheckToEnableCaptcha added in v1.145.0

func CheckToEnableCaptcha(application *Application, organization, username string) (bool, error)

func CheckUpdateUser added in v1.211.0

func CheckUpdateUser(oldUser, user *User, lang string) string

func CheckUserPermission added in v1.42.0

func CheckUserPermission(requestUserId, userId string, strict bool, lang string) (bool, error)

func CheckUserSignup

func CheckUserSignup(application *Application, organization *Organization, form *form.AuthForm, lang string) string

func CheckUsername added in v1.130.2

func CheckUsername(username string, lang string) string

func ClearThroughputPerSecond added in v1.303.0

func ClearThroughputPerSecond()

func ClearUserOAuthProperties

func ClearUserOAuthProperties(user *User, providerType string) (bool, error)

func ContainsAsterisk added in v1.106.0

func ContainsAsterisk(userId string, users []string) bool

func CreateTables added in v1.239.0

func CreateTables(createDatabase bool)

func DailSmtpServer added in v1.59.0

func DailSmtpServer(provider *Provider) error

DailSmtpServer Dail Smtp server

func DeleteAdapter added in v1.377.0

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

func DeleteApplication

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

func DeleteBeegoSession added in v1.207.0

func DeleteBeegoSession(sessionIds []string)

func DeleteCert

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

func DeleteEnforcer added in v1.374.0

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

func DeleteFile

func DeleteFile(provider *Provider, objectKey string, lang string) error

func DeleteGroup added in v1.335.0

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

func DeleteLdap

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

func DeleteModel added in v1.54.0

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

func DeleteOrganization

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

func DeletePayment added in v1.16.0

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

func DeletePermission

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

func DeletePlan added in v1.320.0

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

func DeletePricing added in v1.320.0

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

func DeleteProduct added in v1.23.0

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

func DeleteProvider

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

func DeleteResource

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

func DeleteRole

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

func DeleteSession added in v1.207.0

func DeleteSession(id string) (bool, error)

func DeleteSessionId added in v1.207.0

func DeleteSessionId(id string, sessionId string) (bool, error)

func DeleteSubscription added in v1.320.0

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

func DeleteSyncer

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

func DeleteToken

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

func DeleteUser

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

func DeleteWebhook

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

func DisableVerificationCode

func DisableVerificationCode(dest string) (err error)

func DisabledMultiFactorAuth added in v1.345.0

func DisabledMultiFactorAuth(user *User) error

func DoMigration added in v1.239.0

func DoMigration()

func DownloadAndUpload added in v1.136.0

func DownloadAndUpload(url string, fullFilePath string, lang string) (err error)

func Enforce added in v1.83.0

func Enforce(permission *Permission, request *CasbinRequest, permissionIds ...string) (bool, error)

func ExpireTokenByAccessToken added in v1.221.0

func ExpireTokenByAccessToken(accessToken string) (bool, *Application, *Token, error)

func ExtendProductWithProviders added in v1.82.1

func ExtendProductWithProviders(product *Product) error

func ExtendUserWithRolesAndPermissions added in v1.102.0

func ExtendUserWithRolesAndPermissions(user *User) (err error)

func FromProviderToIdpInfo added in v1.358.0

func FromProviderToIdpInfo(ctx *context.Context, provider *Provider) *idp.ProviderInfo

func GenerateCasToken added in v1.36.0

func GenerateCasToken(userId string, service string) (string, error)

func GenerateId added in v1.36.0

func GenerateId()

func GenerateSamlRequest added in v1.295.0

func GenerateSamlRequest(id, relayState, host, lang string) (auth string, method string, err error)

func GetAdapterCount added in v1.377.0

func GetAdapterCount(owner, field, value string) (int64, error)

func GetAllActions added in v1.83.0

func GetAllActions(userId string) []string

func GetAllObjects added in v1.83.0

func GetAllObjects(userId string) []string

func GetAllRoles added in v1.83.0

func GetAllRoles(userId string) []string

func GetApplicationCount

func GetApplicationCount(owner, field, value string) (int64, error)

func GetAuthorizationCodeToken added in v1.22.0

func GetAuthorizationCodeToken(application *Application, clientSecret string, code string, verifier string) (*Token, *TokenError, error)

GetAuthorizationCodeToken Authorization code flow

func GetBuiltInModel added in v1.218.0

func GetBuiltInModel(modelText string) (model.Model, error)

func GetCaptcha

func GetCaptcha() (string, []byte, error)

func GetCertCount

func GetCertCount(owner, field, value string) (int64, error)

func GetClientCredentialsToken added in v1.22.0

func GetClientCredentialsToken(application *Application, clientSecret string, scope string, host string) (*Token, *TokenError, error)

GetClientCredentialsToken Client Credentials flow

func GetEnforcerCount added in v1.374.0

func GetEnforcerCount(owner, field, value string) (int64, error)

func GetExistUuids added in v1.297.1

func GetExistUuids(owner string, uuids []string) ([]string, error)

func GetFaviconUrl added in v1.342.0

func GetFaviconUrl(htmlStr string) (string, error)

func GetGlobalCertsCount added in v1.312.0

func GetGlobalCertsCount(field, value string) (int64, error)

func GetGlobalProviderCount added in v1.151.0

func GetGlobalProviderCount(field, value string) (int64, error)

func GetGlobalUserCount

func GetGlobalUserCount(field, value string) (int64, error)

func GetGroupCount added in v1.335.0

func GetGroupCount(owner, field, value string) (int64, error)

func GetGroupUserCount added in v1.338.0

func GetGroupUserCount(groupName string, field, value string) (int64, error)

func GetJsonWebKeySet

func GetJsonWebKeySet() (jose.JSONWebKeySet, error)

func GetModelCount added in v1.54.0

func GetModelCount(owner, field, value string) (int64, error)

func GetOAuthToken

func GetOAuthToken(grantType string, clientId string, clientSecret string, code string, verifier string, scope string, username string, password string, host string, refreshToken string, tag string, avatar string, lang string) (interface{}, error)

func GetOnlineUserCount

func GetOnlineUserCount(owner string, isOnline int) (int64, error)

func GetOrganizationApplicationCount added in v1.161.0

func GetOrganizationApplicationCount(owner, Organization, field, value string) (int64, error)

func GetOrganizationCount

func GetOrganizationCount(owner, field, value string) (int64, error)

func GetPasswordToken added in v1.22.0

func GetPasswordToken(application *Application, username string, password string, scope string, host string) (*Token, *TokenError, error)

GetPasswordToken Resource Owner Password Credentials flow

func GetPaymentCount added in v1.16.0

func GetPaymentCount(owner, field, value string) (int64, error)

func GetPermissionCount

func GetPermissionCount(owner, field, value string) (int64, error)

func GetPermissionsAndRolesByUser added in v1.341.0

func GetPermissionsAndRolesByUser(userId string) ([]*Permission, []*Role, error)

func GetPlanCount added in v1.320.0

func GetPlanCount(owner, field, value string) (int64, error)

func GetPolicies added in v1.377.1

func GetPolicies(adapter *Adapter) ([]*xormadapter.CasbinRule, error)

func GetPricingCount added in v1.320.0

func GetPricingCount(owner, field, value string) (int64, error)

func GetProductCount added in v1.23.0

func GetProductCount(owner, field, value string) (int64, error)

func GetProviderCount

func GetProviderCount(owner, field, value string) (int64, error)

func GetRecordCount

func GetRecordCount(field, value string, filterRecord *Record) (int64, error)

func GetResourceCount

func GetResourceCount(owner, user, field, value string) (int64, error)

func GetRoleCount

func GetRoleCount(owner, field, value string) (int64, error)

func GetSamlResponse added in v1.38.0

func GetSamlResponse(application *Application, user *User, samlRequest string, host string) (string, string, string, error)

GetSamlResponse generates a SAML2.0 response parameter samlRequest is saml request in base64 format

func GetSession

func GetSession(owner string, offset, limit int, field, value, sortField, sortOrder string) *xorm.Session

func GetSessionCount added in v1.207.0

func GetSessionCount(owner, field, value string) (int64, error)

func GetSessionForUser added in v1.328.0

func GetSessionForUser(owner string, offset, limit int, field, value, sortField, sortOrder string) *xorm.Session

func GetSubscriptionCount added in v1.320.0

func GetSubscriptionCount(owner, field, value string) (int64, error)

func GetSyncerCount

func GetSyncerCount(owner, organization, field, value string) (int64, error)

func GetTokenCount

func GetTokenCount(owner, organization, field, value string) (int64, error)

func GetTruncatedPath added in v1.237.0

func GetTruncatedPath(provider *Provider, fullFilePath string, limit int) string

func GetUploadFileUrl added in v1.168.0

func GetUploadFileUrl(provider *Provider, fullFilePath string, hasTimestamp bool) (string, string)

func GetUserCount

func GetUserCount(owner, field, value string, groupName string) (int64, error)

func GetUserField

func GetUserField(user *User, field string) string

func GetValidationBySaml added in v1.39.0

func GetValidationBySaml(samlRequest string, host string) (string, string, error)

GetValidationBySaml * @ret1: saml response @ret2: the service URL who requested to issue this token @ret3: error

func GetVerifyType added in v1.288.0

func GetVerifyType(username string) (verificationCodeType string)

func GetWebAuthnObject added in v1.68.0

func GetWebAuthnObject(host string) (*webauthn.WebAuthn, error)

func GetWebhookCount

func GetWebhookCount(owner, organization, field, value string) (int64, error)

func GetWechatMiniProgramToken added in v1.41.0

func GetWechatMiniProgramToken(application *Application, code string, host string, username string, avatar string, lang string) (*Token, *TokenError, error)

GetWechatMiniProgramToken Wechat Mini Program flow

func GroupChangeTrigger added in v1.343.0

func GroupChangeTrigger(oldName, newName string) error

func GroupPermissionsByModelAdapter added in v1.347.1

func GroupPermissionsByModelAdapter(permissions []*Permission) map[string][]string

GroupPermissionsByModelAdapter group permissions by model and adapter. Every model and adapter will be a key, and the value is a list of permission ids. With each list of permission ids have the same key, we just need to init the enforcer and do the enforce/batch-enforce once (with list of permission ids as the policyFilter when the enforcer load policy).

func HasRoleDefinition added in v1.219.0

func HasRoleDefinition(m model.Model) bool

func HasUserByField

func HasUserByField(organizationName string, field string, value string) bool

func InitAdapter

func InitAdapter(createDatabase bool)

func InitConfig

func InitConfig()

func InitDb

func InitDb()

func InitDefaultStorageProvider

func InitDefaultStorageProvider()

func InitFromFile added in v1.63.0

func InitFromFile()

func InitLdapAutoSynchronizer

func InitLdapAutoSynchronizer()

func InvoicePayment added in v1.44.9

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

func IsAllowSend added in v1.157.0

func IsAllowSend(user *User, remoteAddr, recordType string) error

func IsGrantTypeValid added in v1.24.0

func IsGrantTypeValid(method string, grantTypes []string) bool

IsGrantTypeValid Check if grantType is allowed in the current application authorization_code is allowed by default

func IsNeedPromptMfa added in v1.360.0

func IsNeedPromptMfa(org *Organization, user *User) bool

func IsOriginAllowed added in v1.191.0

func IsOriginAllowed(origin string) (bool, error)

func IsSessionDuplicated added in v1.239.0

func IsSessionDuplicated(id string, sessionId string) (bool, error)

func LinkUserAccount

func LinkUserAccount(user *User, field string, value string) (bool, error)

func MfaRecover added in v1.345.0

func MfaRecover(user *User, recoveryCode string) error

func NewSamlResponse added in v1.38.0

func NewSamlResponse(user *User, host string, certificate string, destination string, iss string, requestId string, redirectUri []string) (*etree.Element, error)

NewSamlResponse returns a saml2 response

func NewSamlResponse11 added in v1.39.0

func NewSamlResponse11(user *User, requestID string, host string) *etree.Element

NewSamlResponse11 return a saml1.1 response(not 2.0)

func ParseSamlResponse

func ParseSamlResponse(samlResponse string, provider *Provider, host string) (string, error)

func RefreshToken

func RefreshToken(grantType string, refreshToken string, scope string, clientId string, clientSecret string, host string) (interface{}, error)

func RemovePolicy added in v1.166.0

func RemovePolicy(policy []string, adapter *Adapter) (bool, error)

func RemoveUserFromGroup added in v1.338.0

func RemoveUserFromGroup(owner, name, groupName string) (bool, error)

func RunSyncUsersJob

func RunSyncUsersJob()

func RunSyncer added in v1.44.0

func RunSyncer(syncer *Syncer)

func SendEmail

func SendEmail(provider *Provider, title string, content string, dest string, sender string) error

func SendSms

func SendSms(provider *Provider, content string, phoneNumbers ...string) error

func SendVerificationCodeToEmail

func SendVerificationCodeToEmail(organization *Organization, user *User, provider *Provider, remoteAddr string, dest string) error

func SendVerificationCodeToPhone

func SendVerificationCodeToPhone(organization *Organization, user *User, provider *Provider, remoteAddr string, dest string) error

func SendWebhooks

func SendWebhooks(record *Record) error

func SetPreferredMultiFactorAuth added in v1.345.0

func SetPreferredMultiFactorAuth(user *User, mfaType string) error

func SetUserField

func SetUserField(user *User, field string, value string) (bool, error)

func SetUserOAuthProperties

func SetUserOAuthProperties(organization *Organization, user *User, providerType string, userInfo *idp.UserInfo) (bool, error)

func StoreCasTokenForPgt added in v1.36.0

func StoreCasTokenForPgt(token *CasAuthenticationSuccess, service, userId string) string

func StoreCasTokenForProxyTicket added in v1.36.0

func StoreCasTokenForProxyTicket(token *CasAuthenticationSuccess, targetService, userId string) string

func SyncLdapUsers

func SyncLdapUsers(owner string, syncUsers []LdapUser, ldapId string) (existUsers []LdapUser, failedUsers []LdapUser, err error)

func UpdateAdapter added in v1.377.0

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

func UpdateApplication

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

func UpdateCert

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

func UpdateEnforcer added in v1.374.0

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

func UpdateGroup added in v1.335.0

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

func UpdateLdap

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

func UpdateLdapSyncTime

func UpdateLdapSyncTime(ldapId string) error

func UpdateModel added in v1.54.0

func UpdateModel(id string, modelObj *Model) (bool, error)

func UpdateModelWithCheck added in v1.226.0

func UpdateModelWithCheck(id string, modelObj *Model) error

func UpdateOrganization

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

func UpdatePayment added in v1.16.0

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

func UpdatePermission

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

func UpdatePlan added in v1.320.0

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

func UpdatePolicy added in v1.166.0

func UpdatePolicy(oldPolicy, newPolicy []string, adapter *Adapter) (bool, error)

func UpdatePricing added in v1.320.0

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

func UpdateProduct added in v1.23.0

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

func UpdateProvider

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

func UpdateResource

func UpdateResource(id string, resource *Resource) (bool, error)

func UpdateRole

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

func UpdateSession added in v1.239.0

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

func UpdateSubscription added in v1.320.0

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

func UpdateSyncer

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

func UpdateToken

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

func UpdateUser

func UpdateUser(id string, user *User, columns []string, isAdmin bool) (bool, error)

func UpdateUserForAllFields

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

func UpdateUserToOriginalDatabase

func UpdateUserToOriginalDatabase(user *User) error

func UpdateWebhook

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

func UploadFileSafe

func UploadFileSafe(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffer, lang string) (string, string, error)

func UploadPermissions added in v1.325.0

func UploadPermissions(owner string, fileId string) (bool, error)

func UploadRoles added in v1.325.0

func UploadRoles(owner string, fileId string) (bool, error)

func UploadUsers

func UploadUsers(owner string, fileId string) (bool, error)

func VerifyCaptcha

func VerifyCaptcha(id string, digits string) bool

Types

type AccountItem added in v1.57.0

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

func GetAccountItemByName added in v1.77.1

func GetAccountItemByName(name string, organization *Organization) *AccountItem

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"`

	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"`

	*xormadapter.Adapter `xorm:"-" json:"-"`
}

func GetAdapter added in v1.377.0

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

func GetAdapters added in v1.377.0

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

func GetPaginationAdapters added in v1.377.0

func GetPaginationAdapters(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Adapter, error)

func (*Adapter) GetId added in v1.377.0

func (adapter *Adapter) GetId() string

type Affiliation

type Affiliation struct {
	Id   int    `xorm:"int notnull pk autoincr" json:"id"`
	Name string `xorm:"varchar(128)" json:"name"`
}

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"`
	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"`
	EnablePassword      bool            `json:"enablePassword"`
	EnableSignUp        bool            `json:"enableSignUp"`
	EnableSigninSession bool            `json:"enableSigninSession"`
	EnableAutoSignin    bool            `json:"enableAutoSignin"`
	EnableCodeSignin    bool            `json:"enableCodeSignin"`
	EnableSamlCompress  bool            `json:"enableSamlCompress"`
	EnableWebAuthn      bool            `json:"enableWebAuthn"`
	EnableLinkWithEmail bool            `json:"enableLinkWithEmail"`
	OrgChoiceMode       string          `json:"orgChoiceMode"`
	SamlReplyUrl        string          `xorm:"varchar(100)" json:"samlReplyUrl"`
	Providers           []*ProviderItem `xorm:"mediumtext" json:"providers"`
	SignupItems         []*SignupItem   `xorm:"varchar(1000)" json:"signupItems"`
	GrantTypes          []string        `xorm:"varchar(1000)" json:"grantTypes"`
	OrganizationObj     *Organization   `xorm:"-" json:"organizationObj"`
	Tags                []string        `xorm:"mediumtext" json:"tags"`

	ClientId             string     `xorm:"varchar(100)" json:"clientId"`
	ClientSecret         string     `xorm:"varchar(100)" json:"clientSecret"`
	RedirectUris         []string   `xorm:"varchar(1000)" json:"redirectUris"`
	TokenFormat          string     `xorm:"varchar(100)" json:"tokenFormat"`
	ExpireInHours        int        `json:"expireInHours"`
	RefreshExpireInHours int        `json:"refreshExpireInHours"`
	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"`
	TermsOfUse           string     `xorm:"varchar(100)" json:"termsOfUse"`
	SignupHtml           string     `xorm:"mediumtext" json:"signupHtml"`
	SigninHtml           string     `xorm:"mediumtext" json:"signinHtml"`
	ThemeData            *ThemeData `xorm:"json" json:"themeData"`
	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"`
}

func CheckOAuthLogin

func CheckOAuthLogin(clientId string, responseType string, redirectUri string, scope string, state string, lang string) (string, *Application, error)

func GetApplication

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

func GetApplicationByClientId

func GetApplicationByClientId(clientId string) (*Application, error)

func GetApplicationByOrganizationName

func GetApplicationByOrganizationName(organization string) (*Application, error)

func GetApplicationByUser

func GetApplicationByUser(user *User) (*Application, error)

func GetApplicationByUserId

func GetApplicationByUserId(userId string) (application *Application, err error)

func GetApplications

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

func GetDefaultApplication added in v1.114.0

func GetDefaultApplication(id string) (*Application, error)

func GetMaskedApplication

func GetMaskedApplication(application *Application, userId string) *Application

func GetMaskedApplications

func GetMaskedApplications(applications []*Application, userId string) []*Application

func GetOrganizationApplications added in v1.161.0

func GetOrganizationApplications(owner string, organization string) ([]*Application, error)

func GetPaginationApplications

func GetPaginationApplications(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Application, error)

func GetPaginationOrganizationApplications added in v1.161.0

func GetPaginationOrganizationApplications(owner, organization string, offset, limit int, field, value, sortField, sortOrder string) ([]*Application, error)

func (*Application) GetEmailProvider

func (application *Application) GetEmailProvider() (*Provider, error)

func (*Application) GetId

func (application *Application) GetId() string

func (*Application) GetProviderByCategory

func (application *Application) GetProviderByCategory(category string) (*Provider, error)

func (*Application) GetProviderItem

func (application *Application) GetProviderItem(providerName string) *ProviderItem

func (*Application) GetProviderItemByType added in v1.77.3

func (application *Application) GetProviderItemByType(providerType string) *ProviderItem

func (*Application) GetSignupItemRule

func (application *Application) GetSignupItemRule(itemName string) string

func (*Application) GetSmsProvider

func (application *Application) GetSmsProvider() (*Provider, error)

func (*Application) GetStorageProvider

func (application *Application) GetStorageProvider() (*Provider, error)

func (*Application) HasPromptPage

func (application *Application) HasPromptPage() bool

func (*Application) IsRedirectUriValid added in v1.191.0

func (application *Application) IsRedirectUriValid(redirectUri string) bool

func (*Application) IsSignupItemRequired

func (application *Application) IsSignupItemRequired(itemName string) bool

func (*Application) IsSignupItemVisible

func (application *Application) IsSignupItemVisible(itemName string) bool

type Attribute added in v1.38.0

type Attribute struct {
	XMLName      xml.Name
	Name         string `xml:"Name,attr"`
	NameFormat   string `xml:"NameFormat,attr"`
	FriendlyName string `xml:"FriendlyName,attr"`
	Xmlns        string `xml:"xmlns,attr"`
}

type CasAnyAttribute added in v1.36.0

type CasAnyAttribute struct {
	XMLName xml.Name
	Value   string `xml:",chardata"`
}

type CasAttributes added in v1.36.0

type CasAttributes struct {
	XMLName                                xml.Name  `xml:"cas:attributes" json:"-"`
	AuthenticationDate                     time.Time `xml:"cas:authenticationDate"`
	LongTermAuthenticationRequestTokenUsed bool      `xml:"cas:longTermAuthenticationRequestTokenUsed"`
	IsFromNewLogin                         bool      `xml:"cas:isFromNewLogin"`
	MemberOf                               []string  `xml:"cas:memberOf"`
	UserAttributes                         *CasUserAttributes
	ExtraAttributes                        []*CasAnyAttribute `xml:",any"`
}

func (*CasAttributes) DeepCopy added in v1.36.0

func (c *CasAttributes) DeepCopy() CasAttributes

type CasAuthenticationFailure added in v1.36.0

type CasAuthenticationFailure struct {
	XMLName xml.Name `xml:"cas:authenticationFailure" json:"-"`
	Code    string   `xml:"code,attr"`
	Message string   `xml:",innerxml"`
}

type CasAuthenticationSuccess added in v1.36.0

type CasAuthenticationSuccess struct {
	XMLName             xml.Name           `xml:"cas:authenticationSuccess" json:"-"`
	User                string             `xml:"cas:user"`
	ProxyGrantingTicket string             `xml:"cas:proxyGrantingTicket,omitempty"`
	Proxies             *CasProxies        `xml:"cas:proxies"`
	Attributes          *CasAttributes     `xml:"cas:attributes"`
	ExtraAttributes     []*CasAnyAttribute `xml:",any"`
}

func GetCasTokenByPgt added in v1.36.0

func GetCasTokenByPgt(pgt string) (bool, *CasAuthenticationSuccess, string, string)

GetCasTokenByPgt * @ret1: whether a token is found @ret2: token, nil if not found @ret3: the service URL who requested to issue this token @ret4: userIf of user who requested to issue this token

func GetCasTokenByTicket added in v1.36.0

func GetCasTokenByTicket(ticket string) (bool, *CasAuthenticationSuccess, string, string)

GetCasTokenByTicket * @ret1: whether a token is found @ret2: token, nil if not found @ret3: the service URL who requested to issue this token @ret4: userIf of user who requested to issue this token

func (*CasAuthenticationSuccess) DeepCopy added in v1.36.0

type CasAuthenticationSuccessWrapper added in v1.36.0

type CasAuthenticationSuccessWrapper struct {
	AuthenticationSuccess *CasAuthenticationSuccess // the token we issued
	Service               string                    // to which service this token is issued
	UserId                string
}

type CasNamedAttribute added in v1.36.0

type CasNamedAttribute struct {
	XMLName xml.Name `xml:"cas:attribute" json:"-"`
	Name    string   `xml:"name,attr,omitempty"`
	Value   string   `xml:",innerxml"`
}

type CasProxies added in v1.36.0

type CasProxies struct {
	XMLName xml.Name `xml:"cas:proxies" json:"-"`
	Proxies []string `xml:"cas:proxy"`
}

func (*CasProxies) DeepCopy added in v1.36.0

func (c *CasProxies) DeepCopy() CasProxies

type CasProxyFailure added in v1.36.0

type CasProxyFailure struct {
	XMLName xml.Name `xml:"cas:proxyFailure" json:"-"`
	Code    string   `xml:"code,attr"`
	Message string   `xml:",innerxml"`
}

type CasProxySuccess added in v1.36.0

type CasProxySuccess struct {
	XMLName     xml.Name `xml:"cas:proxySuccess" json:"-"`
	ProxyTicket string   `xml:"cas:proxyTicket"`
}

type CasServiceResponse added in v1.36.0

type CasServiceResponse struct {
	XMLName      xml.Name `xml:"cas:serviceResponse" json:"-"`
	Xmlns        string   `xml:"xmlns:cas,attr"`
	Failure      *CasAuthenticationFailure
	Success      *CasAuthenticationSuccess
	ProxySuccess *CasProxySuccess
	ProxyFailure *CasProxyFailure
}

type CasUserAttributes added in v1.36.0

type CasUserAttributes struct {
	XMLName       xml.Name             `xml:"cas:userAttributes" json:"-"`
	Attributes    []*CasNamedAttribute `xml:"cas:attribute"`
	AnyAttributes []*CasAnyAttribute   `xml:",any"`
}

func (*CasUserAttributes) DeepCopy added in v1.36.0

func (c *CasUserAttributes) DeepCopy() CasUserAttributes

type CasbinRequest added in v1.313.0

type CasbinRequest = []interface{}

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"`
}

func GetCert

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

func GetCerts

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

func GetDefaultCert

func GetDefaultCert() (*Cert, error)

func GetGlobleCerts added in v1.312.0

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

func GetMaskedCert

func GetMaskedCert(cert *Cert) *Cert

func GetMaskedCerts

func GetMaskedCerts(certs []*Cert, err error) ([]*Cert, error)

func GetPaginationCerts

func GetPaginationCerts(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Cert, error)

func GetPaginationGlobalCerts added in v1.312.0

func GetPaginationGlobalCerts(offset, limit int, field, value, sortField, sortOrder string) ([]*Cert, error)

func (*Cert) GetId

func (p *Cert) GetId() string

type Claims

type Claims struct {
	*User
	TokenType string `json:"tokenType,omitempty"`
	Nonce     string `json:"nonce,omitempty"`
	Tag       string `json:"tag,omitempty"`
	Scope     string `json:"scope,omitempty"`
	jwt.RegisteredClaims
}

func ParseJwtToken

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

func ParseJwtTokenByApplication added in v1.26.0

func ParseJwtTokenByApplication(token string, application *Application) (*Claims, error)

type ClaimsShort

type ClaimsShort struct {
	*UserShort
	TokenType string `json:"tokenType,omitempty"`
	Nonce     string `json:"nonce,omitempty"`
	Scope     string `json:"scope,omitempty"`
	jwt.RegisteredClaims
}

type ClaimsWithoutThirdIdp added in v1.224.0

type ClaimsWithoutThirdIdp struct {
	*UserWithoutThirdIdp
	TokenType string `json:"tokenType,omitempty"`
	Nonce     string `json:"nonce,omitempty"`
	Tag       string `json:"tag,omitempty"`
	Scope     string `json:"scope,omitempty"`
	jwt.RegisteredClaims
}

type Code

type Code struct {
	Message string `xorm:"varchar(100)" json:"message"`
	Code    string `xorm:"varchar(100)" json:"code"`
}

func GetOAuthCode

func GetOAuthCode(userId string, clientId string, responseType string, redirectUri string, scope string, state string, nonce string, challenge string, host string, lang string) (*Code, error)

type Credential added in v1.37.0

type Credential struct {
	Value string `json:"value"`
	Salt  string `json:"salt"`
}

type Enforcer added in v1.374.0

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"`

	*casbin.Enforcer
}

func GetEnforcer added in v1.374.0

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

func GetEnforcers added in v1.374.0

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

func GetPaginationEnforcers added in v1.374.0

func GetPaginationEnforcers(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Enforcer, error)

func (*Enforcer) InitEnforcer added in v1.377.0

func (enforcer *Enforcer) InitEnforcer() error

type GaugeVecInfo added in v1.303.0

type GaugeVecInfo struct {
	Method     string  `json:"method"`
	Name       string  `json:"name"`
	Throughput float64 `json:"throughput"`
}

type Group added in v1.335.0

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        []*User `xorm:"-" json:"users"`

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

	IsEnabled bool `json:"isEnabled"`
}

func ConvertToTreeData added in v1.335.0

func ConvertToTreeData(groups []*Group, parentId string) []*Group

func GetGroup added in v1.335.0

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

func GetGroups added in v1.335.0

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

func GetPaginationGroups added in v1.335.0

func GetPaginationGroups(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Group, error)

func (*Group) GetId added in v1.335.0

func (group *Group) GetId() string

type GroupNode added in v1.335.0

type GroupNode struct{}
type Header struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type HistogramVecInfo added in v1.303.0

type HistogramVecInfo struct {
	Method  string `json:"method"`
	Name    string `json:"name"`
	Count   uint64 `json:"count"`
	Latency string `json:"latency"`
}

type IdpEntityDescriptor added in v1.38.0

type IdpEntityDescriptor struct {
	XMLName  xml.Name `xml:"EntityDescriptor"`
	DS       string   `xml:"xmlns:ds,attr"`
	XMLNS    string   `xml:"xmlns,attr"`
	MD       string   `xml:"xmlns:md,attr"`
	EntityId string   `xml:"entityID,attr"`

	IdpSSODescriptor IdpSSODescriptor `xml:"IDPSSODescriptor"`
}

IdpEntityDescriptor SAML METADATA

func GetSamlMeta added in v1.38.0

func GetSamlMeta(application *Application, host string) (*IdpEntityDescriptor, error)

type IdpSSODescriptor added in v1.38.0

type IdpSSODescriptor struct {
	XMLName                    xml.Name `xml:"urn:oasis:names:tc:SAML:2.0:metadata IDPSSODescriptor"`
	ProtocolSupportEnumeration string   `xml:"protocolSupportEnumeration,attr"`
	SigningKeyDescriptor       KeyDescriptor
	NameIDFormats              []NameIDFormat      `xml:"NameIDFormat"`
	SingleSignOnService        SingleSignOnService `xml:"SingleSignOnService"`
	Attribute                  []Attribute         `xml:"Attribute"`
}

type InitData added in v1.63.0

type InitData struct {
	Organizations []*Organization `json:"organizations"`
	Applications  []*Application  `json:"applications"`
	Users         []*User         `json:"users"`
	Certs         []*Cert         `json:"certs"`
	Providers     []*Provider     `json:"providers"`
	Ldaps         []*Ldap         `json:"ldaps"`
	Models        []*Model        `json:"models"`
	Permissions   []*Permission   `json:"permissions"`
	Payments      []*Payment      `json:"payments"`
	Products      []*Product      `json:"products"`
	Resources     []*Resource     `json:"resources"`
	Roles         []*Role         `json:"roles"`
	Syncers       []*Syncer       `json:"syncers"`
	Tokens        []*Token        `json:"tokens"`
	Webhooks      []*Webhook      `json:"webhooks"`
}

type IntrospectionResponse added in v1.26.0

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

type KeyDescriptor added in v1.38.0

type KeyDescriptor struct {
	XMLName xml.Name `xml:"KeyDescriptor"`
	Use     string   `xml:"use,attr"`
	KeyInfo KeyInfo  `xml:"KeyInfo"`
}

type KeyInfo added in v1.38.0

type KeyInfo struct {
	XMLName  xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# KeyInfo"`
	X509Data X509Data `xml:",innerxml"`
}

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"`
	Username     string   `xorm:"varchar(100)" json:"username"`
	Password     string   `xorm:"varchar(100)" json:"password"`
	BaseDn       string   `xorm:"varchar(100)" json:"baseDn"`
	Filter       string   `xorm:"varchar(200)" json:"filter"`
	FilterFields []string `xorm:"varchar(100)" json:"filterFields"`

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

func GetLdap

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

func GetLdaps

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

func GetMaskedLdap added in v1.362.1

func GetMaskedLdap(ldap *Ldap, errs ...error) (*Ldap, error)

func GetMaskedLdaps added in v1.362.1

func GetMaskedLdaps(ldaps []*Ldap, errs ...error) ([]*Ldap, error)

func (*Ldap) GetLdapConn added in v1.270.0

func (ldap *Ldap) GetLdapConn() (c *LdapConn, err error)

type LdapAutoSynchronizer

type LdapAutoSynchronizer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func GetLdapAutoSynchronizer

func GetLdapAutoSynchronizer() *LdapAutoSynchronizer

func NewLdapAutoSynchronizer

func NewLdapAutoSynchronizer() *LdapAutoSynchronizer

func (*LdapAutoSynchronizer) LdapAutoSynchronizerStartUpAll

func (l *LdapAutoSynchronizer) LdapAutoSynchronizerStartUpAll() error

LdapAutoSynchronizerStartUpAll start all autosync goroutine for existing ldap servers in each organizations

func (*LdapAutoSynchronizer) StartAutoSync

func (l *LdapAutoSynchronizer) StartAutoSync(ldapId string) error

StartAutoSync start autosync for specified ldap, old existing autosync goroutine will be ceased

func (*LdapAutoSynchronizer) StopAutoSync

func (l *LdapAutoSynchronizer) StopAutoSync(ldapId string)

type LdapConn added in v1.293.0

type LdapConn struct {
	Conn *goldap.Conn
	IsAD bool
}

func (*LdapConn) GetLdapUsers added in v1.293.0

func (l *LdapConn) GetLdapUsers(ldapServer *Ldap) ([]LdapUser, error)

type LdapUser added in v1.317.0

type LdapUser struct {
	UidNumber string `json:"uidNumber"`
	Uid       string `json:"uid"`
	Cn        string `json:"cn"`
	GidNumber string `json:"gidNumber"`
	// Gcn                   string
	Uuid                  string `json:"uuid"`
	DisplayName           string `json:"displayName"`
	Mail                  string
	Email                 string `json:"email"`
	EmailAddress          string
	TelephoneNumber       string
	Mobile                string
	MobileTelephoneNumber string
	RegisteredAddress     string
	PostalAddress         string

	GroupId string `json:"groupId"`
	Phone   string `json:"phone"`
	Address string `json:"address"`
}

func AutoAdjustLdapUser added in v1.317.0

func AutoAdjustLdapUser(users []LdapUser) []LdapUser

func (*LdapUser) GetLdapUuid added in v1.317.0

func (ldapUser *LdapUser) GetLdapUuid() string
type Link struct {
	Rel   string
	Sizes string
	Href  string
}

type ManagedAccount added in v1.98.1

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 MfaInterface added in v1.309.0

type MfaInterface interface {
	Initiate(ctx *context.Context, userId string) (*MfaProps, error)
	SetupVerify(ctx *context.Context, passcode string) error
	Enable(ctx *context.Context, user *User) error
	Verify(passcode string) error
}

func GetMfaUtil added in v1.309.0

func GetMfaUtil(mfaType string, config *MfaProps) MfaInterface

type MfaItem added in v1.315.0

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

type MfaProps added in v1.309.0

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"`
}

func GetAllMfaProps added in v1.345.0

func GetAllMfaProps(user *User, masked bool) []*MfaProps

type Migrator added in v1.239.0

type Migrator interface {
	IsMigrationNeeded() bool
	DoMigration() *migrate.Migration
}

type Migrator_1_101_0_PR_1083 added in v1.239.0

type Migrator_1_101_0_PR_1083 struct{}

func (*Migrator_1_101_0_PR_1083) DoMigration added in v1.239.0

func (*Migrator_1_101_0_PR_1083) DoMigration() *migrate.Migration

func (*Migrator_1_101_0_PR_1083) IsMigrationNeeded added in v1.239.0

func (*Migrator_1_101_0_PR_1083) IsMigrationNeeded() bool

type Migrator_1_235_0_PR_1530 added in v1.239.0

type Migrator_1_235_0_PR_1530 struct{}

func (*Migrator_1_235_0_PR_1530) DoMigration added in v1.239.0

func (*Migrator_1_235_0_PR_1530) DoMigration() *migrate.Migration

func (*Migrator_1_235_0_PR_1530) IsMigrationNeeded added in v1.239.0

func (*Migrator_1_235_0_PR_1530) IsMigrationNeeded() bool

type Migrator_1_240_0_PR_1539 added in v1.240.0

type Migrator_1_240_0_PR_1539 struct{}

func (*Migrator_1_240_0_PR_1539) DoMigration added in v1.240.0

func (*Migrator_1_240_0_PR_1539) DoMigration() *migrate.Migration

func (*Migrator_1_240_0_PR_1539) IsMigrationNeeded added in v1.240.0

func (*Migrator_1_240_0_PR_1539) IsMigrationNeeded() bool

type Migrator_1_314_0_PR_1841 added in v1.314.0

type Migrator_1_314_0_PR_1841 struct{}

func (*Migrator_1_314_0_PR_1841) DoMigration added in v1.314.0

func (*Migrator_1_314_0_PR_1841) DoMigration() *migrate.Migration

func (*Migrator_1_314_0_PR_1841) IsMigrationNeeded added in v1.314.0

func (*Migrator_1_314_0_PR_1841) IsMigrationNeeded() bool

type Model added in v1.54.0

type Model 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"`

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

	model.Model `xorm:"-" json:"-"`
}

func GetModel added in v1.54.0

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

func GetModels added in v1.54.0

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

func GetPaginationModels added in v1.54.0

func GetPaginationModels(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Model, error)

func (*Model) GetId added in v1.54.0

func (m *Model) GetId() string

type NameIDFormat added in v1.38.0

type NameIDFormat struct {
	XMLName xml.Name
	Value   string `xml:",innerxml"`
}

type OidcDiscovery

type OidcDiscovery struct {
	Issuer                                 string   `json:"issuer"`
	AuthorizationEndpoint                  string   `json:"authorization_endpoint"`
	TokenEndpoint                          string   `json:"token_endpoint"`
	UserinfoEndpoint                       string   `json:"userinfo_endpoint"`
	JwksUri                                string   `json:"jwks_uri"`
	IntrospectionEndpoint                  string   `json:"introspection_endpoint"`
	ResponseTypesSupported                 []string `json:"response_types_supported"`
	ResponseModesSupported                 []string `json:"response_modes_supported"`
	GrantTypesSupported                    []string `json:"grant_types_supported"`
	SubjectTypesSupported                  []string `json:"subject_types_supported"`
	IdTokenSigningAlgValuesSupported       []string `json:"id_token_signing_alg_values_supported"`
	ScopesSupported                        []string `json:"scopes_supported"`
	ClaimsSupported                        []string `json:"claims_supported"`
	RequestParameterSupported              bool     `json:"request_parameter_supported"`
	RequestObjectSigningAlgValuesSupported []string `json:"request_object_signing_alg_values_supported"`
	EndSessionEndpoint                     string   `json:"end_session_endpoint"`
}

func GetOidcDiscovery

func GetOidcDiscovery(host string) OidcDiscovery

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"`
	Favicon            string     `xorm:"varchar(100)" json:"favicon"`
	PasswordType       string     `xorm:"varchar(100)" json:"passwordType"`
	PasswordSalt       string     `xorm:"varchar(100)" json:"passwordSalt"`
	PasswordOptions    []string   `xorm:"varchar(100)" json:"passwordOptions"`
	CountryCodes       []string   `xorm:"varchar(200)"  json:"countryCodes"`
	DefaultAvatar      string     `xorm:"varchar(200)" json:"defaultAvatar"`
	DefaultApplication string     `xorm:"varchar(100)" json:"defaultApplication"`
	Tags               []string   `xorm:"mediumtext" json:"tags"`
	Languages          []string   `xorm:"varchar(255)" json:"languages"`
	ThemeData          *ThemeData `xorm:"json" json:"themeData"`
	MasterPassword     string     `xorm:"varchar(100)" json:"masterPassword"`
	InitScore          int        `json:"initScore"`
	EnableSoftDeletion bool       `json:"enableSoftDeletion"`
	IsProfilePublic    bool       `json:"isProfilePublic"`

	MfaItems     []*MfaItem     `xorm:"varchar(300)" json:"mfaItems"`
	AccountItems []*AccountItem `xorm:"varchar(5000)" json:"accountItems"`
}

func GetMaskedOrganization

func GetMaskedOrganization(organization *Organization, errs ...error) (*Organization, error)

func GetMaskedOrganizations

func GetMaskedOrganizations(organizations []*Organization, errs ...error) ([]*Organization, error)

func GetOrganization

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

func GetOrganizationByUser

func GetOrganizationByUser(user *User) (*Organization, error)

func GetOrganizations

func GetOrganizations(owner string, name ...string) ([]*Organization, error)

func GetOrganizationsByFields added in v1.324.0

func GetOrganizationsByFields(owner string, fields ...string) ([]*Organization, error)

func GetPaginationOrganizations

func GetPaginationOrganizations(owner string, name string, offset, limit int, field, value, sortField, sortOrder string) ([]*Organization, error)

func (*Organization) GetInitScore added in v1.317.0

func (org *Organization) GetInitScore() (int, error)

type OriginalUser

type OriginalUser = User

type Ormer added in v1.377.0

type Ormer struct {
	Engine *xorm.Engine
	// contains filtered or unexported fields
}

Ormer represents the MySQL adapter for policy storage.

func NewAdapter

func NewAdapter(driverName string, dataSourceName string, dbName string) *Ormer

NewAdapter is the constructor for Ormer.

func (*Ormer) CreateDatabase added in v1.377.0

func (a *Ormer) CreateDatabase() error

type Payment added in v1.16.0

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
	ProductName        string  `xorm:"varchar(100)" json:"productName"`
	ProductDisplayName string  `xorm:"varchar(100)" json:"productDisplayName"`
	Detail             string  `xorm:"varchar(255)" json:"detail"`
	Tag                string  `xorm:"varchar(100)" json:"tag"`
	Currency           string  `xorm:"varchar(100)" json:"currency"`
	Price              float64 `json:"price"`
	ReturnUrl          string  `xorm:"varchar(1000)" json:"returnUrl"`
	// 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
	OutOrderId string          `xorm:"varchar(100)" json:"outOrderId"`
	PayUrl     string          `xorm:"varchar(2000)" json:"payUrl"`
	State      pp.PaymentState `xorm:"varchar(100)" json:"state"`
	Message    string          `xorm:"varchar(2000)" json:"message"`
}

func GetPaginationPayments added in v1.16.0

func GetPaginationPayments(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Payment, error)

func GetPayment added in v1.16.0

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

func GetPayments added in v1.16.0

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

func GetUserPayments added in v1.29.0

func GetUserPayments(owner, user string) ([]*Payment, error)

func NotifyPayment added in v1.27.6

func NotifyPayment(request *http.Request, body []byte, owner string, paymentName string, orderId string) (*Payment, error)

func (*Payment) GetId added in v1.16.0

func (payment *Payment) GetId() string

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"`
	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 GetMaskedPermissions added in v1.206.0

func GetMaskedPermissions(permissions []*Permission) []*Permission

func GetPaginationPermissions

func GetPaginationPermissions(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Permission, error)

func GetPermission

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

func GetPermissions

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

func GetPermissionsByModel added in v1.313.0

func GetPermissionsByModel(owner string, model string) ([]*Permission, error)

func GetPermissionsByResource added in v1.316.0

func GetPermissionsByResource(resourceId string) ([]*Permission, error)

func GetPermissionsByRole added in v1.92.0

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

func GetPermissionsBySubmitter added in v1.88.1

func GetPermissionsBySubmitter(owner string, submitter string) ([]*Permission, error)

func (*Permission) GetId

func (p *Permission) GetId() string

type PermissionRule added in v1.69.0

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 added in v1.320.0

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"`

	PricePerMonth float64 `json:"pricePerMonth"`
	PricePerYear  float64 `json:"pricePerYear"`
	Currency      string  `xorm:"varchar(100)" json:"currency"`
	IsEnabled     bool    `json:"isEnabled"`

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

func GetPaginatedPlans added in v1.320.0

func GetPaginatedPlans(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Plan, error)

func GetPlan added in v1.320.0

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

func GetPlans added in v1.320.0

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

func (*Plan) GetId added in v1.320.0

func (plan *Plan) GetId() string

type Pricing added in v1.320.0

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"`
}

func GetPaginatedPricings added in v1.320.0

func GetPaginatedPricings(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Pricing, error)

func GetPricing added in v1.320.0

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

func GetPricings added in v1.320.0

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

func (*Pricing) GetId added in v1.320.0

func (pricing *Pricing) GetId() string

func (*Pricing) HasPlan added in v1.320.0

func (pricing *Pricing) HasPlan(owner string, plan string) (bool, error)

type Product added in v1.23.0

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(255)" json:"detail"`
	Description string   `xorm:"varchar(100)" 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"`
	Providers   []string `xorm:"varchar(100)" json:"providers"`
	ReturnUrl   string   `xorm:"varchar(1000)" json:"returnUrl"`

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

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

func GetPaginationProducts added in v1.23.0

func GetPaginationProducts(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Product, error)

func GetProduct added in v1.23.0

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

func GetProducts added in v1.23.0

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

func (*Product) GetId added in v1.23.0

func (product *Product) GetId() string

type PrometheusInfo added in v1.303.0

type PrometheusInfo struct {
	ApiThroughput   []GaugeVecInfo     `json:"apiThroughput"`
	ApiLatency      []HistogramVecInfo `json:"apiLatency"`
	TotalThroughput float64            `json:"totalThroughput"`
}

func GetPrometheusInfo added in v1.303.0

func GetPrometheusInfo() (*PrometheusInfo, error)

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 GetCaptchaProviderByApplication added in v1.57.0

func GetCaptchaProviderByApplication(applicationId, isCurrentProvider, lang string) (*Provider, error)

func GetCaptchaProviderByOwnerName added in v1.57.0

func GetCaptchaProviderByOwnerName(applicationId, lang string) (*Provider, error)

func GetGlobalProviders added in v1.151.0

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

func GetMaskedProvider

func GetMaskedProvider(provider *Provider, isMaskEnabled bool) *Provider

func GetMaskedProviders

func GetMaskedProviders(providers []*Provider, isMaskEnabled bool) []*Provider

func GetPaginationGlobalProviders added in v1.151.0

func GetPaginationGlobalProviders(offset, limit int, field, value, sortField, sortOrder string) ([]*Provider, error)

func GetPaginationProviders

func GetPaginationProviders(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Provider, error)

func GetProvider

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

func GetProviders

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

func GetWechatMiniProgramProvider added in v1.41.0

func GetWechatMiniProgramProvider(application *Application) *Provider

func (*Provider) GetId

func (p *Provider) GetId() string

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"`
}

func (*ProviderItem) IsProviderVisible

func (pi *ProviderItem) IsProviderVisible() bool

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"`

	Object       string `xorm:"-" json:"object"`
	ExtendedUser *User  `xorm:"-" json:"extendedUser"`

	IsTriggered bool `json:"isTriggered"`
}

func GetPaginationRecords

func GetPaginationRecords(offset, limit int, field, value, sortField, sortOrder string, filterRecord *Record) ([]*Record, error)

func GetRecords

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

func GetRecordsByField

func GetRecordsByField(record *Record) ([]*Record, error)

func NewRecord

func NewRecord(ctx *context.Context) *Record

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"`
}

func GetDirectResources added in v1.378.1

func GetDirectResources(owner string, user string, provider *Provider, prefix string, lang string) ([]*Resource, error)

func GetPaginationResources

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

func GetResource

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

func GetResources

func GetResources(owner string, user string) ([]*Resource, error)

func (*Resource) GetId

func (resource *Resource) GetId() string

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"`
	Roles     []string `xorm:"mediumtext" json:"roles"`
	Domains   []string `xorm:"mediumtext" json:"domains"`
	IsEnabled bool     `json:"isEnabled"`
}

func GetAncestorRoles added in v1.307.0

func GetAncestorRoles(roleIds ...string) ([]*Role, error)

GetAncestorRoles returns a list of roles that contain the given roleIds

func GetMaskedRoles added in v1.206.0

func GetMaskedRoles(roles []*Role) []*Role

func GetPaginationRoles

func GetPaginationRoles(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Role, error)

func GetRole

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

func GetRoles

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

func GetRolesByNamePrefix added in v1.307.0

func GetRolesByNamePrefix(owner string, prefix string) ([]*Role, error)

func GetRolesByUser added in v1.77.0

func GetRolesByUser(userId string) ([]*Role, error)

func (*Role) GetId

func (role *Role) GetId() string

type Saml11AssertionArtifact added in v1.39.0

type Saml11AssertionArtifact struct {
	XMLName  xml.Name `xml:"AssertionArtifact"`
	InnerXML string   `xml:",innerxml"`
}

type Saml11Request added in v1.39.0

type Saml11Request struct {
	XMLName           xml.Name `xml:"Request"`
	SAMLP             string   `xml:"samlp,attr"`
	MajorVersion      string   `xml:"MajorVersion,attr"`
	MinorVersion      string   `xml:"MinorVersion,attr"`
	RequestID         string   `xml:"RequestID,attr"`
	IssueInstant      string   `xml:"IssueInstance,attr"`
	AssertionArtifact Saml11AssertionArtifact
}

type Session added in v1.207.0

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 added in v1.207.0

func GetPaginationSessions(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Session, error)

func GetSessions added in v1.207.0

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

func GetSingleSession added in v1.239.0

func GetSingleSession(id string) (*Session, error)

func (*Session) GetId added in v1.240.2

func (session *Session) GetId() string

type SignupItem

type SignupItem struct {
	Name     string `json:"name"`
	Visible  bool   `json:"visible"`
	Required bool   `json:"required"`
	Prompted bool   `json:"prompted"`
	Rule     string `json:"rule"`
}

type SingleSignOnService added in v1.38.0

type SingleSignOnService struct {
	XMLName  xml.Name
	Binding  string `xml:"Binding,attr"`
	Location string `xml:"Location,attr"`
}

type SmsMfa added in v1.309.0

type SmsMfa struct {
	Config *MfaProps
}

func NewEmailMfaUtil added in v1.349.0

func NewEmailMfaUtil(config *MfaProps) *SmsMfa

func NewSmsMfaUtil added in v1.349.0

func NewSmsMfaUtil(config *MfaProps) *SmsMfa

func (*SmsMfa) Enable added in v1.309.0

func (mfa *SmsMfa) Enable(ctx *context.Context, user *User) error

func (*SmsMfa) Initiate added in v1.309.0

func (mfa *SmsMfa) Initiate(ctx *context.Context, userId string) (*MfaProps, error)

func (*SmsMfa) SetupVerify added in v1.309.0

func (mfa *SmsMfa) SetupVerify(ctx *context.Context, passCode string) error

func (*SmsMfa) Verify added in v1.309.0

func (mfa *SmsMfa) Verify(passCode string) error

type Subscription added in v1.320.0

type Subscription 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"`

	StartDate   time.Time `json:"startDate"`
	EndDate     time.Time `json:"endDate"`
	Duration    int       `json:"duration"`
	Description string    `xorm:"varchar(100)" json:"description"`

	User string `xorm:"mediumtext" json:"user"`
	Plan string `xorm:"varchar(100)" json:"plan"`

	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 GetPaginationSubscriptions added in v1.320.0

func GetPaginationSubscriptions(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Subscription, error)

func GetSubscription added in v1.320.0

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

func GetSubscriptions added in v1.320.0

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

func NewSubscription added in v1.320.0

func NewSubscription(owner string, user string, plan string, duration int) *Subscription

func Subscribe added in v1.320.0

func Subscribe(owner string, user string, plan string, pricing string) (*Subscription, error)

func (*Subscription) GetId added in v1.320.0

func (subscription *Subscription) GetId() string

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"`

	Ormer *Ormer `xorm:"-" json:"-"`
}

func GetMaskedSyncer

func GetMaskedSyncer(syncer *Syncer) *Syncer

func GetMaskedSyncers

func GetMaskedSyncers(syncers []*Syncer) []*Syncer

func GetOrganizationSyncers added in v1.312.0

func GetOrganizationSyncers(owner, organization string) ([]*Syncer, error)

func GetPaginationSyncers

func GetPaginationSyncers(owner, organization string, offset, limit int, field, value, sortField, sortOrder string) ([]*Syncer, error)

func GetSyncer

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

func GetSyncers

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

func (*Syncer) GetId

func (syncer *Syncer) GetId() string

type TableColumn

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

type ThemeData added in v1.227.0

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"`
	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"`
}

func GetPaginationTokens

func GetPaginationTokens(owner, organization string, offset, limit int, field, value, sortField, sortOrder string) ([]*Token, error)

func GetToken

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

func GetTokenByAccessToken added in v1.14.1

func GetTokenByAccessToken(accessToken string) (*Token, error)

func GetTokenByTokenAndApplication added in v1.26.0

func GetTokenByTokenAndApplication(token string, application string) (*Token, error)

func GetTokenByUser added in v1.24.0

func GetTokenByUser(application *Application, user *User, scope string, host string) (*Token, error)

GetTokenByUser Implicit flow

func GetTokens

func GetTokens(owner string, organization string) ([]*Token, error)

func (*Token) GetId added in v1.189.0

func (token *Token) GetId() string

type TokenError added in v1.62.5

type TokenError struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description,omitempty"`
}

type TokenWrapper

type TokenWrapper struct {
	AccessToken  string `json:"access_token"`
	IdToken      string `json:"id_token"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
}

type TotpMfa added in v1.349.0

type TotpMfa struct {
	Config *MfaProps
	// contains filtered or unexported fields
}

func NewTotpMfaUtil added in v1.349.0

func NewTotpMfaUtil(config *MfaProps) *TotpMfa

func (*TotpMfa) Enable added in v1.349.0

func (mfa *TotpMfa) Enable(ctx *context.Context, user *User) error

func (*TotpMfa) Initiate added in v1.349.0

func (mfa *TotpMfa) Initiate(ctx *context.Context, userId string) (*MfaProps, error)

func (*TotpMfa) SetupVerify added in v1.349.0

func (mfa *TotpMfa) SetupVerify(ctx *context.Context, passcode string) error

func (*TotpMfa) Verify added in v1.349.0

func (mfa *TotpMfa) Verify(passcode string) error

type User

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

	Id                string   `xorm:"varchar(100) index" json:"id"`
	Type              string   `xorm:"varchar(100)" json:"type"`
	Password          string   `xorm:"varchar(100)" 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:"varchar(500)" 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(20) 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"`
	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"`
	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"`
	IsDefaultAvatar   bool     `json:"isDefaultAvatar"`
	IsOnline          bool     `json:"isOnline"`
	IsAdmin           bool     `json:"isAdmin"`
	IsGlobalAdmin     bool     `json:"isGlobalAdmin"`
	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"`
	AccessKey         string   `xorm:"varchar(100)" json:"accessKey"`
	AccessSecret      string   `xorm:"varchar(100)" json:"accessSecret"`

	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"`
	Casdoor         string `xorm:"casdoor varchar(100)" json:"casdoor"`
	Infoflow        string `xorm:"infoflow varchar(100)" json:"infoflow"`
	Apple           string `xorm:"apple varchar(100)" json:"apple"`
	AzureAD         string `xorm:"azuread varchar(100)" json:"azuread"`
	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"`
	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"`
	Custom          string `xorm:"custom varchar(100)" json:"custom"`

	WebauthnCredentials []webauthn.Credential `xorm:"webauthnCredentials blob" json:"webauthnCredentials"`
	PreferredMfaType    string                `xorm:"varchar(100)" json:"preferredMfaType"`
	RecoveryCodes       []string              `xorm:"varchar(1000)" json:"recoveryCodes"`
	TotpSecret          string                `xorm:"varchar(100)" json:"totpSecret"`
	MfaPhoneEnabled     bool                  `json:"mfaPhoneEnabled"`
	MfaEmailEnabled     bool                  `json:"mfaEmailEnabled"`
	MultiFactorAuths    []*MfaProps           `xorm:"-" json:"multiFactorAuths,omitempty"`

	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:"groups varchar(1000)" json:"groups"`

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

	ManagedAccounts []ManagedAccount `xorm:"managedAccounts blob" json:"managedAccounts"`
}

func CheckUserPassword

func CheckUserPassword(organization string, username string, password string, lang string, options ...bool) (*User, string)

func ExtendManagedAccountsWithUser added in v1.105.0

func ExtendManagedAccountsWithUser(user *User) (*User, error)

func GetGlobalUsers

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

func GetGroupUsers added in v1.338.0

func GetGroupUsers(groupName string) ([]*User, error)

func GetLastUser

func GetLastUser(owner string) (*User, error)

func GetMaskedUser

func GetMaskedUser(user *User, isAdminOrSelf bool, errs ...error) (*User, error)

func GetMaskedUsers

func GetMaskedUsers(users []*User, errs ...error) ([]*User, error)

func GetPaginationGlobalUsers

func GetPaginationGlobalUsers(offset, limit int, field, value, sortField, sortOrder string) ([]*User, error)

func GetPaginationGroupUsers added in v1.338.0

func GetPaginationGroupUsers(groupName string, offset, limit int, field, value, sortField, sortOrder string) ([]*User, error)

func GetPaginationUsers

func GetPaginationUsers(owner string, offset, limit int, field, value, sortField, sortOrder string, groupName string) ([]*User, error)

func GetSortedUsers

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

func GetUser

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

func GetUserByAccessKey added in v1.337.0

func GetUserByAccessKey(accessKey string) (*User, error)

func GetUserByEmail

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

func GetUserByField

func GetUserByField(organizationName string, field string, value string) (*User, error)

func GetUserByFields

func GetUserByFields(organization string, field string) (*User, error)

func GetUserByPhone added in v1.78.0

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

func GetUserByUserId added in v1.70.0

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

func GetUserNoCheck

func GetUserNoCheck(id string) (*User, error)

func GetUsers

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

func GetUsersByTag added in v1.313.0

func GetUsersByTag(owner string, tag string) ([]*User, error)

func (*User) AddCredentials added in v1.68.0

func (user *User) AddCredentials(credential webauthn.Credential, isGlobalAdmin bool) (bool, error)

func (*User) CredentialExcludeList added in v1.68.0

func (user *User) CredentialExcludeList() []protocol.CredentialDescriptor

CredentialExcludeList returns a CredentialDescriptor array filled with all the user's credentials

func (*User) DeleteCredentials added in v1.68.0

func (user *User) DeleteCredentials(credentialIdBase64 string) (bool, error)

func (*User) GetCountryCode added in v1.245.0

func (user *User) GetCountryCode(countryCode string) string

func (*User) GetId

func (user *User) GetId() string

func (*User) GetMfaProps added in v1.345.0

func (user *User) GetMfaProps(mfaType string, masked bool) *MfaProps

func (*User) GetPreferredMfaProps added in v1.345.0

func (user *User) GetPreferredMfaProps(masked bool) *MfaProps

func (*User) IsAdminUser added in v1.304.0

func (user *User) IsAdminUser() bool

func (*User) IsApplicationAdmin added in v1.375.1

func (user *User) IsApplicationAdmin(application *Application) bool

func (*User) IsMfaEnabled added in v1.309.0

func (user *User) IsMfaEnabled() bool

func (*User) UpdateUserHash

func (user *User) UpdateUserHash() error

func (*User) UpdateUserPassword

func (user *User) UpdateUserPassword(organization *Organization)

func (*User) WebAuthnCredentials added in v1.68.0

func (user *User) WebAuthnCredentials() []webauthn.Credential

func (*User) WebAuthnDisplayName added in v1.68.0

func (user *User) WebAuthnDisplayName() string

func (*User) WebAuthnID added in v1.68.0

func (user *User) WebAuthnID() []byte

WebAuthnID implementation of webauthn.User interface

func (*User) WebAuthnIcon added in v1.68.0

func (user *User) WebAuthnIcon() string

func (*User) WebAuthnName added in v1.68.0

func (user *User) WebAuthnName() string

type UserShort

type UserShort struct {
	Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name  string `xorm:"varchar(100) notnull pk" json:"name"`
}

type UserWithoutThirdIdp added in v1.224.0

type UserWithoutThirdIdp 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"`
	Id                  string            `xorm:"varchar(100) index" json:"id"`
	Type                string            `xorm:"varchar(100)" json:"type"`
	Password            string            `xorm:"varchar(100)" json:"password"`
	PasswordSalt        string            `xorm:"varchar(100)" json:"passwordSalt"`
	DisplayName         string            `xorm:"varchar(100)" json:"displayName"`
	FirstName           string            `xorm:"varchar(100)" json:"firstName"`
	LastName            string            `xorm:"varchar(100)" json:"lastName"`
	Avatar              string            `xorm:"varchar(500)" json:"avatar"`
	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"`
	Location            string            `xorm:"varchar(100)" json:"location"`
	Address             []string          `json:"address"`
	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"`
	Homepage            string            `xorm:"varchar(100)" json:"homepage"`
	Bio                 string            `xorm:"varchar(100)" json:"bio"`
	Tag                 string            `xorm:"varchar(100)" json:"tag"`
	Region              string            `xorm:"varchar(100)" json:"region"`
	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"`
	IsDefaultAvatar     bool              `json:"isDefaultAvatar"`
	IsOnline            bool              `json:"isOnline"`
	IsAdmin             bool              `json:"isAdmin"`
	IsGlobalAdmin       bool              `json:"isGlobalAdmin"`
	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"`
	CreatedIp           string            `xorm:"varchar(100)" json:"createdIp"`
	LastSigninTime      string            `xorm:"varchar(100)" json:"lastSigninTime"`
	LastSigninIp        string            `xorm:"varchar(100)" json:"lastSigninIp"`
	Ldap                string            `xorm:"ldap varchar(100)" json:"ldap"`
	Properties          map[string]string `json:"properties"`
	Roles               []*Role           `xorm:"-" json:"roles"`
	Permissions         []*Permission     `xorm:"-" json:"permissions"`
	LastSigninWrongTime string            `xorm:"varchar(100)" json:"lastSigninWrongTime"`
	SigninWrongTimes    int               `json:"signinWrongTimes"`
}

type Userinfo added in v1.19.1

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"`
	Avatar      string   `json:"picture,omitempty"`
	Address     string   `json:"address,omitempty"`
	Phone       string   `json:"phone,omitempty"`
	Groups      []string `json:"groups,omitempty"`
}

func GetUserInfo added in v1.19.1

func GetUserInfo(user *User, scope string, aud string, host string) *Userinfo

type ValidatorFunc added in v1.341.0

type ValidatorFunc func(password string) string

type VerificationRecord

type VerificationRecord 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"`

	RemoteAddr string `xorm:"varchar(100)"`
	Type       string `xorm:"varchar(10)"`
	User       string `xorm:"varchar(100) notnull"`
	Provider   string `xorm:"varchar(100) notnull"`
	Receiver   string `xorm:"varchar(100) notnull"`
	Code       string `xorm:"varchar(10) notnull"`
	Time       int64  `xorm:"notnull"`
	IsUsed     bool
}

type VerifyResult added in v1.271.0

type VerifyResult struct {
	Code int
	Msg  string
}

func CheckVerificationCode

func CheckVerificationCode(dest, code, lang string) *VerifyResult

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(100)" 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"`
	IsUserExtended bool      `json:"isUserExtended"`
	IsEnabled      bool      `json:"isEnabled"`
}

func GetPaginationWebhooks

func GetPaginationWebhooks(owner, organization string, offset, limit int, field, value, sortField, sortOrder string) ([]*Webhook, error)

func GetWebhook

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

func GetWebhooks

func GetWebhooks(owner string, organization string) ([]*Webhook, error)

func (*Webhook) GetId

func (p *Webhook) GetId() string

type X509Certificate added in v1.38.0

type X509Certificate struct {
	XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# X509Certificate"`
	Cert    string   `xml:",innerxml"`
}

type X509Data added in v1.38.0

type X509Data struct {
	XMLName         xml.Name        `xml:"http://www.w3.org/2000/09/xmldsig# X509Data"`
	X509Certificate X509Certificate `xml:",innerxml"`
}

type X509Key added in v1.38.0

type X509Key struct {
	X509Certificate string
	PrivateKey      string
}

func (X509Key) GetKeyPair added in v1.38.0

func (x X509Key) GetKeyPair() (privateKey *rsa.PrivateKey, cert []byte, err error)

Jump to

Keyboard shortcuts

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