nauth

package
v0.0.0-...-8144993 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientSecretPost  = "client_secret_post"
	ClientSecretBasic = "client_secret_basic"
	None              = "none"
	CurrentUserToken  = "UserToken"
)
View Source
const (
	SdkName         string = "nauth-golang-sdk"
	Version         string = "0.1.0"
	CoreAuthApiHost string = "https://nauth.netkit.cloud/api"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthUrlResult

type AuthUrlResult struct {
	Url   string
	State string
	Nonce string
}

type AuthenticationAdmin

type AuthenticationAdmin struct {
	ClientUser  *dto.User
	UserContext map[string]interface{}
	// contains filtered or unexported fields
}

func (*AuthenticationAdmin) AddApp

func (*AuthenticationAdmin) AddAppUser

func (cli *AuthenticationAdmin) AddAppUser(appUser dto.AppUserCreateDto) (*common.BaseResponse, error)

func (*AuthenticationAdmin) AddUser

func (cli *AuthenticationAdmin) AddUser(userInfo dto.AddUserDto) (*common.BaseResponse, error)

func (*AuthenticationAdmin) CreateAction

func (c *AuthenticationAdmin) CreateAction(resource_id string, params *param.CreateAction) (resp dto.ActionDto, err error)

增加资源操作

func (*AuthenticationAdmin) CreateResource

func (c *AuthenticationAdmin) CreateResource(params *param.CreateResource) (resp dto.ResourceDto, err error)

增加资源

func (*AuthenticationAdmin) DeleteAction

func (c *AuthenticationAdmin) DeleteAction(action_id string) (resp common.BaseResponse, err error)

删除资源操作

func (*AuthenticationAdmin) DeleteApp

func (cli *AuthenticationAdmin) DeleteApp(appId string) (*common.BaseResponse, error)

func (*AuthenticationAdmin) DeleteAppUser

func (cli *AuthenticationAdmin) DeleteAppUser(appUser dto.AppUserDeleteDto) (*common.BaseResponse, error)

func (*AuthenticationAdmin) DeleteResource

func (c *AuthenticationAdmin) DeleteResource(resource_id string) (resp common.BaseResponse, err error)

删除资源

func (*AuthenticationAdmin) DeleteUser

func (cli *AuthenticationAdmin) DeleteUser(userId string) (*common.BaseResponse, error)

func (*AuthenticationAdmin) GetAccessKey

func (cli *AuthenticationAdmin) GetAccessKey(accessKey string) (*dto.AccessKey, error)

func (*AuthenticationAdmin) GetAction

func (c *AuthenticationAdmin) GetAction(action_id string) (resp dto.ActionDto, err error)

获取指定资源操作

func (*AuthenticationAdmin) GetApp

func (cli *AuthenticationAdmin) GetApp(appId string) (*dto.GetUserResponseDto, error)

func (*AuthenticationAdmin) GetResource

func (c *AuthenticationAdmin) GetResource(resource_id string) (resp dto.ResourceDto, err error)

获取指定资源

func (*AuthenticationAdmin) GetUserById

func (cli *AuthenticationAdmin) GetUserById(userId string) (*dto.GetUserResponseDto, error)

func (*AuthenticationAdmin) GetUserByUsername

func (cli *AuthenticationAdmin) GetUserByUsername(username string) (*dto.GetUserResponseDto, error)

func (*AuthenticationAdmin) ListAllAction

func (c *AuthenticationAdmin) ListAllAction(pagination param.QueryResource) (resp dto.ListResourceDto, err error)

获取所有资源下所有操作信息

func (*AuthenticationAdmin) ListApp

func (cli *AuthenticationAdmin) ListApp(pagination common.PaginationParams) (appListResp dto.ListAppDto, err error)

func (*AuthenticationAdmin) ListAppUser

func (cli *AuthenticationAdmin) ListAppUser(pagination common.PaginationParams) (resp dto.ListAppUserDto, err error)

func (*AuthenticationAdmin) ListResource

func (c *AuthenticationAdmin) ListResource(pagination param.QueryResource) (resp dto.ListResourceDto, err error)

获取资源列表

func (*AuthenticationAdmin) ListResourceActions

func (c *AuthenticationAdmin) ListResourceActions(resource_id string, pagination param.QueryResource) (resp dto.ListResourceDto, err error)

获取指定资源下所有操作信息

func (*AuthenticationAdmin) ListUser

func (cli *AuthenticationAdmin) ListUser(pagination param.QueryUsers) (userListResp dto.UserListDto, err error)

func (*AuthenticationAdmin) SendHttpRequest

func (c *AuthenticationAdmin) SendHttpRequest(requestUrl string, method string, reqDto interface{}) ([]byte, error)

func (*AuthenticationAdmin) SocialWxOfficeSendMsg

func (c *AuthenticationAdmin) SocialWxOfficeSendMsg(tenant, identifier string, msg *dto.SocialWxOfficeTemplateMsgDto) (*common.BaseResponse, error)

第三方微信公众号向用户发送模板消息

func (*AuthenticationAdmin) UpdateAction

func (c *AuthenticationAdmin) UpdateAction(action_id string, params *param.UpdateAction) (resp common.BaseResponse, err error)

更新资源操作

func (*AuthenticationAdmin) UpdateApp

func (cli *AuthenticationAdmin) UpdateApp(appId string, app dto.UpdateAppDto) (*common.BaseResponse, error)

func (*AuthenticationAdmin) UpdateAppUser

func (cli *AuthenticationAdmin) UpdateAppUser(appUser dto.AppUserUpdateDto) (*common.BaseResponse, error)

func (*AuthenticationAdmin) UpdateResource

func (c *AuthenticationAdmin) UpdateResource(resource_id string, params *param.UpdateResource) (resp common.BaseResponse, err error)

更新资源

func (*AuthenticationAdmin) UpdateUser

func (cli *AuthenticationAdmin) UpdateUser(userId string, userInfo dto.UpdateUserDto) (*common.BaseResponse, error)

type AuthenticationClient

type AuthenticationClient struct {
	AccessToken string
	ClientUser  *dto.User
	UserContext map[string]interface{}
	// contains filtered or unexported fields
}

func (*AuthenticationClient) AddAccessKey

func (cli *AuthenticationClient) AddAccessKey(dto dto.AddAccessKeyDto) (*dto.AccessKey, error)

func (*AuthenticationClient) Authorize

func (c *AuthenticationClient) Authorize(params *param.AuthorizeResourcesDto) (resp common.BaseResponse, err error)

资源权限授权

func (*AuthenticationClient) CreateDepartment

func (c *AuthenticationClient) CreateDepartment(params *param.CreateDepartment) (resp dto.DepartmentDto, err error)

增加组织

func (*AuthenticationClient) CreateOrganization

func (c *AuthenticationClient) CreateOrganization(params *param.CreateOrganization) (resp dto.OrganizationDto, err error)

增加组织

func (*AuthenticationClient) CreateRole

func (c *AuthenticationClient) CreateRole(params *param.CreateRole) (resp dto.RoleDto, err error)

增加角色

func (*AuthenticationClient) DeleteAccessKey

func (cli *AuthenticationClient) DeleteAccessKey(accessKey string) (*common.BaseResponse, error)

func (*AuthenticationClient) DeleteDepartment

func (c *AuthenticationClient) DeleteDepartment(department_id string) (resp common.BaseResponse, err error)

删除组织

func (*AuthenticationClient) DeleteOrganization

func (c *AuthenticationClient) DeleteOrganization(organization_id string) (resp common.BaseResponse, err error)

删除组织

func (*AuthenticationClient) DeleteRole

func (c *AuthenticationClient) DeleteRole(role_id string) (resp common.BaseResponse, err error)

更新角色

func (*AuthenticationClient) DepBindMember

func (c *AuthenticationClient) DepBindMember(department_id string, params *param.DepartmentUser) (resp common.BaseResponse, err error)

在组织下绑定成员

func (*AuthenticationClient) DepUnbindMember

func (c *AuthenticationClient) DepUnbindMember(department_id string, params *param.DepartmentUser) (resp common.BaseResponse, err error)

在组织下解绑成员

func (*AuthenticationClient) GetAccessKey

func (cli *AuthenticationClient) GetAccessKey(accessKey string) (*dto.AccessKey, error)

func (*AuthenticationClient) GetAccessTokenByCode

func (c *AuthenticationClient) GetAccessTokenByCode(code string) (tokenResponse dto.OIDCTokenResponse, err error)

func (*AuthenticationClient) GetDepartment

func (c *AuthenticationClient) GetDepartment(department_id string) (resp dto.DepartmentDto, err error)

获取指定组织

func (*AuthenticationClient) GetDepartmentUsers

func (c *AuthenticationClient) GetDepartmentUsers(department_id string, pagination common.PaginationParams) (resp dto.ListDepartmentUserDto, err error)

获取指定组织下所有用户信息

func (*AuthenticationClient) GetOAuthLoginUrl

func (c *AuthenticationClient) GetOAuthLoginUrl(state string) string

func (*AuthenticationClient) GetOrganization

func (c *AuthenticationClient) GetOrganization(organization_id string) (resp dto.OrganizationDto, err error)

获取指定组织

func (*AuthenticationClient) GetOrganizationUsers

func (c *AuthenticationClient) GetOrganizationUsers(organization_id string, pagination common.PaginationParams) (resp dto.ListOrganizationUserDto, err error)

获取指定组织下所有用户信息

func (*AuthenticationClient) GetPhoneSMS

func (c *AuthenticationClient) GetPhoneSMS(phone string) error

修改手机号

func (*AuthenticationClient) GetRole

func (c *AuthenticationClient) GetRole(role_id string) (resp dto.RoleDto, err error)

获取指定角色

func (*AuthenticationClient) GetSMS

func (c *AuthenticationClient) GetSMS() error

func (*AuthenticationClient) GetUser

func (c *AuthenticationClient) GetUser() (*dto.User, error)

func (*AuthenticationClient) GetUserByToken

func (c *AuthenticationClient) GetUserByToken(token string) (*dto.User, error)

func (*AuthenticationClient) ListAccessKey

func (cli *AuthenticationClient) ListAccessKey(pagination common.PaginationParams) (accesskeyListResp *dto.ListAccessKeyDto, err error)

func (*AuthenticationClient) ListDepartment

func (c *AuthenticationClient) ListDepartment(pagination param.QueryDepartment) (resp dto.ListDepartmentDto, err error)

获取组织列表

func (*AuthenticationClient) ListOrganization

func (c *AuthenticationClient) ListOrganization(pagination param.QueryOrganization) (resp dto.ListOrganizationDto, err error)

获取组织列表

func (*AuthenticationClient) ListRole

func (c *AuthenticationClient) ListRole(pagination param.QueryRole) (resp dto.ListRoleDto, err error)

获取角色列表

func (*AuthenticationClient) NewClientWithToken

func (c *AuthenticationClient) NewClientWithToken(token string) *AuthenticationClient

TO USE: cli.NewClientWithToken(token).AddAccessKey 根据token新建一个客户端示例

func (*AuthenticationClient) OrgAddMember

func (c *AuthenticationClient) OrgAddMember(organization_id string, params *dto.AddUserDto) (resp common.BaseResponse, err error)

在组织下添加成员

func (*AuthenticationClient) OrgBindMember

func (c *AuthenticationClient) OrgBindMember(organization_id string, params *param.OrganizationUser) (resp common.BaseResponse, err error)

在组织下绑定成员

func (*AuthenticationClient) OrgUnbindMember

func (c *AuthenticationClient) OrgUnbindMember(organization_id string, params *param.OrganizationUser) (resp common.BaseResponse, err error)

在组织下解绑成员

func (*AuthenticationClient) PhoneCodeLogin

func (c *AuthenticationClient) PhoneCodeLogin(login *dto.PhoneCodeLoginDto) (*dto.User, error)

func (*AuthenticationClient) PhonePasswordLoginDto

func (c *AuthenticationClient) PhonePasswordLoginDto(login *dto.PhonePasswordLoginDto) (*dto.User, error)

func (*AuthenticationClient) RegisterByPhoneCode

func (c *AuthenticationClient) RegisterByPhoneCode(dto *dto.PhoneCodeRegisterDto) error

RegisterByPhoneCode 使用用户名密码注册

func (*AuthenticationClient) RegisterByUsername

func (c *AuthenticationClient) RegisterByUsername(dto *dto.UsernameRegisterDto) error

RegisterByUsername 使用用户名密码注册

func (*AuthenticationClient) RsetAccessSecret

func (cli *AuthenticationClient) RsetAccessSecret(accessKey string) (*dto.ResetAccessSecretDto, error)

func (*AuthenticationClient) SendHttpRequest

func (c *AuthenticationClient) SendHttpRequest(requestUrl string, method string, reqDto interface{}) ([]byte, error)

func (*AuthenticationClient) SendLoginPhoneCode

func (c *AuthenticationClient) SendLoginPhoneCode(phone string) (*common.BaseResponse, error)

SendLoginPhoneCode 发送手机注册验证码

func (*AuthenticationClient) SendRegisterPhoneCode

func (c *AuthenticationClient) SendRegisterPhoneCode(phone string) (*common.BaseResponse, error)

SendRegisterPhoneCode 发送手机注册验证码

func (*AuthenticationClient) SetCurrentUser

func (c *AuthenticationClient) SetCurrentUser(user *dto.User) (*dto.User, error)

func (*AuthenticationClient) SetDepartmentUsersIsmanage

func (c *AuthenticationClient) SetDepartmentUsersIsmanage(department_id string,
	params *param.DepartmentUserManagerForm) (resp common.BaseResponse, err error)

设置指定部门下用户是否为部门管理员

func (*AuthenticationClient) SetOrganizationUsersIsmanage

func (c *AuthenticationClient) SetOrganizationUsersIsmanage(organization_id string,
	params *param.OrganizationUserManagerForm) (resp common.BaseResponse, err error)

设置指定组织下用户是否为组织管理员

func (*AuthenticationClient) SetToken

func (c *AuthenticationClient) SetToken(token string) error

func (*AuthenticationClient) SocialBind

func (c *AuthenticationClient) SocialBind(tenant, identifier string, bind *dto.SocialBindDto) (bindDto *dto.SocialBindRespDto, err error)

第三方授权绑定用户(需要token)

func (*AuthenticationClient) SocialLogin

func (c *AuthenticationClient) SocialLogin(tenant, identifier string, login *dto.SocialLoginDto) (sloginResp *dto.SocialLoginRespDto, err error)

第三方授权登陆

func (*AuthenticationClient) SocialLoginCallback

func (c *AuthenticationClient) SocialLoginCallback(tenant, identifier string, login *dto.SocialLoginCallbackDto) (*dto.User, error)

第三方授权登陆回调

func (*AuthenticationClient) SocialUnBind

func (c *AuthenticationClient) SocialUnBind(tenant, identifier string, bind *dto.SocialUnBindDto) (*common.BaseResponse, error)

第三方授权解绑用户(需要token)

func (*AuthenticationClient) SocialWxUserList

func (c *AuthenticationClient) SocialWxUserList(tenant, identifier string, query *dto.WxUserQueryDto) (wxUsersListResp *dto.ListWxUserDto, err error)

获取绑定的微信公众号用户信息

func (*AuthenticationClient) Unauthorize

func (c *AuthenticationClient) Unauthorize(params *param.AuthorizeResourcesDto) (resp common.BaseResponse, err error)

资源权限取消授权

func (*AuthenticationClient) UpdateAccessKey

func (cli *AuthenticationClient) UpdateAccessKey(dto dto.UpdateAccessKeyDto) (*common.BaseResponse, error)

func (*AuthenticationClient) UpdateDepartment

func (c *AuthenticationClient) UpdateDepartment(department_id string, params *param.UpdateDepartment) (resp common.BaseResponse, err error)

更新组织

func (*AuthenticationClient) UpdateOrganization

func (c *AuthenticationClient) UpdateOrganization(organization_id string, params *param.UpdateOrganization) (resp common.BaseResponse, err error)

更新组织

func (*AuthenticationClient) UpdatePhone

func (c *AuthenticationClient) UpdatePhone(phoneDto dto.UpdatePhoneDto) error

修改手机号

func (*AuthenticationClient) UpdateRole

func (c *AuthenticationClient) UpdateRole(role_id string, params *param.UpdateRole) (resp common.BaseResponse, err error)

更新角色

func (*AuthenticationClient) UpdateUserPassword

func (c *AuthenticationClient) UpdateUserPassword(passwordDto *dto.UpdatePasswordDto) error

UpdateUserPassword 更新用户密码

func (*AuthenticationClient) UpdateUserProfile

func (c *AuthenticationClient) UpdateUserProfile(profile *dto.UpdateUserProfileDto) error

UpdateUserProfile 更新用户信息

func (*AuthenticationClient) UpdateUserRoles

func (c *AuthenticationClient) UpdateUserRoles(params *param.UpdateUserRoleForm) (resp common.BaseResponse, err error)

更新用户角色信息(覆盖原先的角色信息)

func (*AuthenticationClient) UserBindRole

func (c *AuthenticationClient) UserBindRole(params *param.UserBindRoleForm) (resp common.BaseResponse, err error)

用户绑定角色

func (*AuthenticationClient) UserUnbindRole

func (c *AuthenticationClient) UserUnbindRole(params *param.UserBindRoleForm) (resp common.BaseResponse, err error)

用户解绑角色

func (*AuthenticationClient) UsernameLogin

func (c *AuthenticationClient) UsernameLogin(login *dto.UsernameLoginDto) (*dto.User, error)

func (*AuthenticationClient) Verify

func (c *AuthenticationClient) Verify(token string) bool

func (*AuthenticationClient) VerifyAction

func (c *AuthenticationClient) VerifyAction(params *param.QueryVerifyAction) (resp dto.VerifyActionDto, err error)

资源权限校验

type AuthenticationClientOptions

type AuthenticationClientOptions struct {
	Host                    string
	Tenant                  string
	Secret                  string
	AppId                   string
	AppSecret               string
	RedirectUri             string
	TokenEndPointAuthMethod string
	Issuer                  string
	UserContext             map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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