oauth2

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(o *Options) *Client

func (*Client) GetToken

func (c *Client) GetToken(ctx context.Context, code string, redirectURI string) (*TokenResponse, error)

func (*Client) GetUserInfo

func (c *Client) GetUserInfo(ctx context.Context, code string, redirectURI string) (*UserInfo, error)

type CustomType

type CustomType struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CustomType) Descriptor

func (*CustomType) Descriptor() ([]byte, []int)

func (*CustomType) ProtoMessage

func (*CustomType) ProtoMessage()

func (*CustomType) Reset

func (m *CustomType) Reset()

func (*CustomType) Size

func (m *CustomType) Size() (n int)

func (*CustomType) String

func (m *CustomType) String() string

func (*CustomType) XXX_DiscardUnknown

func (m *CustomType) XXX_DiscardUnknown()

func (*CustomType) XXX_Marshal

func (m *CustomType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CustomType) XXX_Merge

func (m *CustomType) XXX_Merge(src proto.Message)

func (*CustomType) XXX_Size

func (m *CustomType) XXX_Size() int

func (*CustomType) XXX_Unmarshal

func (m *CustomType) XXX_Unmarshal(b []byte) error

type Options

type Options struct {
	Name                     string                                   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" valid:"required"`
	Icon                     string                                   `protobuf:"bytes,2,opt,name=icon,proto3" json:"icon,omitempty"`
	TokenUrl                 string                                   `protobuf:"bytes,3,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty" valid:"required,url"`
	AuthUrl                  string                                   `protobuf:"bytes,4,opt,name=auth_url,json=authUrl,proto3" json:"auth_url,omitempty" valid:"required,url"`
	ApiUrl                   string                                   `protobuf:"bytes,5,opt,name=api_url,json=apiUrl,proto3" json:"api_url,omitempty" valid:"required,url"`
	ClientId                 string                                   `protobuf:"bytes,6,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" valid:"required"`
	ClientSecret             *github_com_MicroOps_cn_fuck_safe.String `` /* 165-byte string literal not displayed */
	AutoLogin                bool                                     `protobuf:"varint,8,opt,name=auto_login,json=autoLogin,proto3" json:"auto_login,omitempty"`
	Id                       string                                   `protobuf:"bytes,9,opt,name=id,proto3" json:"id,omitempty" valid:"required"`
	LoginId                  string                                   `protobuf:"bytes,10,opt,name=login_id,json=loginId,proto3" json:"login_id,omitempty"`
	EmailAttributePath       string                                   `protobuf:"bytes,11,opt,name=email_attribute_path,json=emailAttributePath,proto3" json:"email_attribute_path,omitempty"`
	UsernameAttributePath    string                                   `` /* 127-byte string literal not displayed */
	PhoneNumberAttributePath string                                   `` /* 138-byte string literal not displayed */
	FullNameAttributePath    string                                   `` /* 129-byte string literal not displayed */
	RoleAttributePath        string                                   `protobuf:"bytes,15,opt,name=role_attribute_path,json=roleAttributePath,proto3" json:"role_attribute_path,omitempty"`
	AvatarAttributePath      string                                   `protobuf:"bytes,16,opt,name=avatar_attribute_path,json=avatarAttributePath,proto3" json:"avatar_attribute_path,omitempty"`
	Scope                    string                                   `protobuf:"bytes,17,opt,name=scope,proto3" json:"scope,omitempty"`
	AutoRedirect             bool                                     `protobuf:"varint,18,opt,name=auto_redirect,json=autoRedirect,proto3" json:"auto_redirect,omitempty"`
	XXX_NoUnkeyedLiteral     struct{}                                 `json:"-"`
	XXX_unrecognized         []byte                                   `json:"-"`
	XXX_sizecache            int32                                    `json:"-"`
}

func NewOptions

func NewOptions() *Options

NewOptions return a default option which host field point to nowhere.

func (*Options) Descriptor

func (*Options) Descriptor() ([]byte, []int)

func (*Options) GetApiUrl

func (m *Options) GetApiUrl() string

func (*Options) GetAuthUrl

func (m *Options) GetAuthUrl() string

func (*Options) GetAutoLogin

func (m *Options) GetAutoLogin() bool

func (*Options) GetAutoRedirect

func (m *Options) GetAutoRedirect() bool

func (*Options) GetAvatarAttributePath

func (m *Options) GetAvatarAttributePath() string

func (*Options) GetClientId

func (m *Options) GetClientId() string

func (*Options) GetEmailAttributePath

func (m *Options) GetEmailAttributePath() string

func (*Options) GetFullNameAttributePath

func (m *Options) GetFullNameAttributePath() string

func (*Options) GetIcon

func (m *Options) GetIcon() string

func (*Options) GetId

func (m *Options) GetId() string

func (*Options) GetLoginId

func (m *Options) GetLoginId() string

func (*Options) GetName

func (m *Options) GetName() string

func (*Options) GetPhoneNumberAttributePath

func (m *Options) GetPhoneNumberAttributePath() string

func (*Options) GetRedirectURL

func (x *Options) GetRedirectURL(ctx context.Context, oriRedirectURI string) (*url.URL, error)

func (*Options) GetRoleAttributePath

func (m *Options) GetRoleAttributePath() string

func (*Options) GetScope

func (m *Options) GetScope() string

func (*Options) GetTokenUrl

func (m *Options) GetTokenUrl() string

func (*Options) GetUsernameAttributePath

func (m *Options) GetUsernameAttributePath() string

func (*Options) ProtoMessage

func (*Options) ProtoMessage()

func (*Options) Reset

func (m *Options) Reset()

func (*Options) Size

func (m *Options) Size() (n int)

func (*Options) String

func (m *Options) String() string

func (*Options) UnmarshalJSONPB

func (x *Options) UnmarshalJSONPB(unmarshaller *jsonpb.Unmarshaler, b []byte) error

func (*Options) XXX_DiscardUnknown

func (m *Options) XXX_DiscardUnknown()

func (*Options) XXX_Marshal

func (m *Options) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Options) XXX_Merge

func (m *Options) XXX_Merge(src proto.Message)

func (*Options) XXX_Size

func (m *Options) XXX_Size() int

func (*Options) XXX_Unmarshal

func (m *Options) XXX_Unmarshal(b []byte) error

type TokenRequest

type TokenRequest struct {
	Code         string `json:"code"`
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	GrantType    string `json:"grant_type"`
	RedirectURI  string `json:"redirect_uri"`
}

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	IdToken     string `json:"id_token"`
}

type UserInfo

type UserInfo struct {
	Username    string `json:"username"`
	FullName    string `json:"fullName"`
	Role        string `json:"role"`
	Email       string `json:"email"`
	PhoneNumber string `json:"phoneNumber"`
	Avatar      string `json:"avatar"`
}

func (UserInfo) String

func (i UserInfo) String() string

Jump to

Keyboard shortcuts

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