Skip to content

Commit

Permalink
update sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
廖长江 committed Oct 20, 2022
1 parent afce9eb commit 479c8e5
Show file tree
Hide file tree
Showing 23 changed files with 182 additions and 13 deletions.
2 changes: 1 addition & 1 deletion authentication/authentication_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var options = AuthenticationClientOptions{
AppSecret: "2140f44a44fcf7684954e37c25d70ce4",
AppHost: "https://sadsdd.cj.mereith.com",
RedirectUri: "http://localhost:3003/callback",
RejectUnauthorized: false,
InsecureSkipVerify: true,
}

const idToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiO" +
Expand Down
8 changes: 8 additions & 0 deletions dto/GetMyAuthorizedResourcesDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dto


type GetMyAuthorizedResourcesDto struct{
Namespace string `json:"namespace,omitempty"`
ResourceType string `json:"resourceType,omitempty"`
}

11 changes: 11 additions & 0 deletions dto/GetMyDepartmentListDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package dto


type GetMyDepartmentListDto struct{
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
WithCustomData bool `json:"withCustomData,omitempty"`
SortBy string `json:"sortBy,omitempty"`
OrderBy string `json:"orderBy,omitempty"`
}

13 changes: 13 additions & 0 deletions dto/GetMyLoginHistoryDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package dto


type GetMyLoginHistoryDto struct{
AppId string `json:"appId,omitempty"`
ClientIp string `json:"clientIp,omitempty"`
Success bool `json:"success,omitempty"`
Start int `json:"start,omitempty"`
End int `json:"end,omitempty"`
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
}

7 changes: 7 additions & 0 deletions dto/GetMyRoleListDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dto


type GetMyRoleListDto struct{
Namespace string `json:"namespace,omitempty"`
}

11 changes: 11 additions & 0 deletions dto/GetTenantListRespDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package dto


type GetTenantListRespDto struct{
StatusCode int `json:"statusCode"`
Message string `json:"message"`
ApiCode int `json:"apiCode,omitempty"`
RequestId string `json:"requestId,omitempty"`
Data []UserTenantListDto `json:"data"`
}

11 changes: 11 additions & 0 deletions dto/RoleListRespDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package dto


type RoleListRespDto struct{
StatusCode int `json:"statusCode"`
Message string `json:"message"`
ApiCode int `json:"apiCode,omitempty"`
RequestId string `json:"requestId,omitempty"`
Data []RoleDto `json:"data"`
}

8 changes: 8 additions & 0 deletions dto/SignInByAdPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dto


type SignInByAdPayloadDto struct{
Password string `json:"password"`
SAMAccountName string `json:"sAMAccountName"`
}

7 changes: 7 additions & 0 deletions dto/SignInByAlipayPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dto


type SignInByAlipayPayloadDto struct{
Code string `json:"code,omitempty"`
}

7 changes: 7 additions & 0 deletions dto/SignInByGooglePayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dto


type SignInByGooglePayloadDto struct{
Code string `json:"code"`
}

7 changes: 7 additions & 0 deletions dto/SignInByLarkInternalPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dto


type SignInByLarkInternalPayloadDto struct{
Code string `json:"code,omitempty"`
}

7 changes: 7 additions & 0 deletions dto/SignInByLarkPublicPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dto


type SignInByLarkPublicPayloadDto struct{
Code string `json:"code,omitempty"`
}

8 changes: 8 additions & 0 deletions dto/SignInByLdapPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dto


type SignInByLdapPayloadDto struct{
Password string `json:"password"`
SAMAccountName string `json:"sAMAccountName"`
}

10 changes: 10 additions & 0 deletions dto/SignInByPassCodePayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package dto


type SignInByPassCodePayloadDto struct{
PassCode string `json:"passCode"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
PhoneCountryCode string `json:"phoneCountryCode,omitempty"`
}

11 changes: 11 additions & 0 deletions dto/SignInByPasswordPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package dto


type SignInByPasswordPayloadDto struct{
Password string `json:"password"`
Account string `json:"account,omitempty"`
Email string `json:"email,omitempty"`
Username string `json:"username,omitempty"`
Phone string `json:"phone,omitempty"`
}

9 changes: 9 additions & 0 deletions dto/SignInByWechatMiniProgramCodePayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package dto


type SignInByWechatMiniProgramCodePayloadDto struct{
EncryptedData string `json:"encryptedData"`
Iv string `json:"iv"`
Code string `json:"code"`
}

9 changes: 9 additions & 0 deletions dto/SignInByWechatMiniProgramPhonePayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package dto


type SignInByWechatMiniProgramPhonePayloadDto struct{
EncryptedData string `json:"encryptedData"`
Iv string `json:"iv"`
Code string `json:"code"`
}

7 changes: 7 additions & 0 deletions dto/SignInByWechatPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dto


type SignInByWechatPayloadDto struct{
Code string `json:"code,omitempty"`
}

7 changes: 7 additions & 0 deletions dto/SignInByWechatworkAgencyPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dto


type SignInByWechatworkAgencyPayloadDto struct{
Code string `json:"code,omitempty"`
}

8 changes: 8 additions & 0 deletions dto/SignInByYidunPayloadDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dto


type SignInByYidunPayloadDto struct{
Token string `json:"token,omitempty"`
AccessToken string `json:"accessToken,omitempty"`
}

9 changes: 9 additions & 0 deletions dto/UserTenantListDto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package dto


type UserTenantListDto struct{
TenantId string `json:"tenantId"`
TenantName string `json:"tenantName"`
JoinAt string `json:"joinAt"`
}

16 changes: 5 additions & 11 deletions management/management_client_options.go
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
package management

import (
"crypto/tls"
"github.com/Authing/authing-golang-sdk/constant"
"net/http"
)

type ManagementClient struct {
HttpClient *http.Client
options *ClientOptions
options *ManagementClientOptions
userPoolId string
}

type ClientOptions struct {
type ManagementClientOptions struct {
AccessKeyId string
AccessKeySecret string
TenantId string
Timeout int
Lang string
Host string
/**
是否拒绝非法的 HTTPS 请求,默认为 true;如果是私有化部署的场景且证书不被信任,可以设置为 false
是否跳过 HTTPS 证书检测,默认为 false;如果是私有化部署的场景且证书不被信任,可以设置为 true
*/
RejectUnauthorized bool
InsecureSkipVerify bool
}

func NewManagementClient(options *ClientOptions) (*ManagementClient, error) {
func NewManagementClient(options *ManagementClientOptions) (*ManagementClient, error) {
if options.Host == "" {
options.Host = constant.ApiServiceUrl
}
Expand All @@ -43,10 +42,5 @@ func NewManagementClient(options *ClientOptions) (*ManagementClient, error) {
)
c.HttpClient = oauth2.NewManagementClient(context.Background(), src)*/
}

if c.options.RejectUnauthorized == false {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}

return c, nil
}
2 changes: 1 addition & 1 deletion management/management_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
var client *ManagementClient

func init() {
options := ClientOptions{
options := ManagementClientOptions{
AccessKeyId: "6343b98b7cf019a9366e9b7c",
AccessKeySecret: "fb0cefa691df76920a1611b9dec38120",
Host: "http://localhost:3000",
Expand Down

0 comments on commit 479c8e5

Please sign in to comment.