Documentation ¶
Index ¶
- func AddApplication(application *Application) (bool, error)
- func AddOrganization(organization *Organization) (bool, error)
- func AddUser(user *User) (bool, error)
- func CheckUserPassword(user *User) (bool, error)
- func DeleteApplication(name string) (bool, error)
- func DeleteOrganization(name string) (bool, error)
- func DeleteResource(name string) (bool, error)
- func DeleteUser(user *User) (bool, error)
- func DoGetBytes(url string) ([]byte, error)
- func DoGetBytesRaw(url string) ([]byte, error)
- func GetMyProfileUrl(accessToken string) string
- func GetOAuthToken(code string, state string) (*oauth2.Token, error)
- func GetSigninUrl(redirectUri string) string
- func GetSignupUrl(enablePassword bool, redirectUri string) string
- func GetUrl(action string, queryMap map[string]string) string
- func GetUserCount(isOnline string) (int, error)
- func GetUserProfileUrl(userName string, accessToken string) string
- func InitConfig(endpoint string, clientId string, clientSecret string, jwtPublicKey string, ...)
- func RefreshOAuthToken(refreshToken string) (*oauth2.Token, error)
- func SendEmail(title string, content string, sender string, receivers ...string) error
- func SendSms(content string, receivers ...string) error
- func UpdateApplication(application *Application) (bool, error)
- func UpdateUser(user *User) (bool, error)
- func UpdateUserForColumns(user *User, columns []string) (bool, error)
- func UploadResource(user string, tag string, parent string, fullFilePath string, fileBytes []byte) (string, string, error)
- func UploadResourceEx(user string, tag string, parent string, fullFilePath string, fileBytes []byte, ...) (string, string, error)
- type Application
- type AuthConfig
- type Claims
- type Organization
- type Permission
- type Resource
- type Response
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddApplication ¶
func AddApplication(application *Application) (bool, error)
func AddOrganization ¶
func AddOrganization(organization *Organization) (bool, error)
func CheckUserPassword ¶
func DeleteApplication ¶
func DeleteOrganization ¶
func DeleteResource ¶
func DeleteUser ¶
func DoGetBytes ¶
DoGetBytes is a general function to get response from param url through HTTP Get method.
func DoGetBytesRaw ¶
DoGetBytesRaw is a general function to get response from param url through HTTP Get method.
func GetMyProfileUrl ¶
func GetOAuthToken ¶
GetOAuthToken gets the pivotal and necessary secret to interact with the Casdoor server
func GetSigninUrl ¶
func GetSignupUrl ¶
func GetUserCount ¶
func GetUserProfileUrl ¶
func InitConfig ¶
func RefreshOAuthToken ¶
RefreshOAuthToken refreshes the OAuth token
func UpdateApplication ¶
func UpdateApplication(application *Application) (bool, error)
func UpdateUser ¶
func UploadResource ¶
Types ¶
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"` Logo string `xorm:"varchar(100) comment('登陆页面logo')" json:"logo"` Title string `xorm:"varchar(100) comment('浏览器标题')" json:"title"` Favicon string `xorm:"varchar(100) comment('浏览器favicon图标')" json:"favicon"` Background string `xorm:"varchar(100) comment('登陆页面背景')" json:"background"` HomeLogo string `xorm:"varchar(100) comment('首页logo')" json:"home_logo"` 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"` EnableCodeSignin bool `json:"enableCodeSignin"` 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"` }
Application has the same definition as https://github.com/casdoor/casdoor/blob/master/object/application.go#L24
func GetApplication ¶
func GetApplication(id string) (*Application, error)
type AuthConfig ¶
type AuthConfig struct { Endpoint string ClientId string ClientSecret string JwtPublicKey string OrganizationName string ApplicationName string }
AuthConfig is the core configuration. The first step to use this SDK is to use the InitConfig function to initialize the global authConfig.
type Claims ¶
func ParseJwtToken ¶
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"` PhonePrefix string `xorm:"varchar(10)" json:"phonePrefix"` DefaultAvatar string `xorm:"varchar(100)" json:"defaultAvatar"` MasterPassword string `xorm:"varchar(100)" json:"masterPassword"` EnableSoftDeletion bool `json:"enableSoftDeletion"` }
Organization has the same definition as https://github.com/casdoor/casdoor/blob/master/object/organization.go#L25
type Permission ¶
type Permission struct { Action string `json:"action"` Actions []string `json:"actions"` CreatedTime string `xorm:"varchar(100)" json:"createdTime"` DisplayName string `xorm:"varchar(100)" json:"displayName"` Effect string `xorm:"varchar(100)" json:"effect"` IsEnabled bool `json:"isEnabled"` Name string `xorm:"varchar(100)" json:"name"` Owner string `xorm:"varchar(100)" json:"owner"` ResourceType string `xorm:"varchar(100)" json:"resourceType"` Resources []string `json:"resources"` Roles []string `json:"roles"` Users []string `json:"users"` }
func GetPermission ¶
func GetPermission() ([]*Permission, error)
type Resource ¶
type Resource struct { Owner string `xorm:"varchar(100) notnull pk" json:"owner"` Name string `xorm:"varchar(100) notnull pk" json:"name"` }
Resource has the same definition as https://github.com/casdoor/casdoor/blob/master/object/resource.go#L24
type Response ¶
type Response struct { Status string `json:"status"` Msg string `json:"msg"` Data interface{} `json:"data"` Data2 interface{} `json:"data2"` }
func AddPermission ¶
func AddPermission(q Permission) (*Response, 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)" json:"createdTime"` UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"` Id string `xorm:"varchar(100)" 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"` Avatar string `xorm:"varchar(255)" json:"avatar"` PermanentAvatar string `xorm:"varchar(255)" json:"permanentAvatar"` Email string `xorm:"varchar(100)" json:"email"` Phone string `xorm:"varchar(100)" 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)" 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"` Github string `xorm:"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"` Ldap string `xorm:"ldap varchar(100)" json:"ldap"` Properties map[string]string `json:"properties"` }
User has the same definition as https://github.com/casdoor/casdoor/blob/master/object/user.go#L24