apple

package
v0.5.31 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BuildOAuthPageURL Apple OAuth2 构建授权页面 URL 的请求地址
	BuildOAuthPageURL = "https://appleid.apple.com/auth/authorize"
	// EndpointPublicKeyURL Apple OAuth2 获取公钥的请求地址
	EndpointPublicKeyURL = "https://appleid.apple.com/auth/keys"
	// EndpointTokenURL Apple OAuth2 获取 Token 的请求地址
	EndpointTokenURL = "https://appleid.apple.com/auth/token"
)
View Source
const (
	ScopeOpenId = "openid" // OpenID
	ScopeEmail  = "email"  // 邮箱
	ScopeName   = "name"   // 姓名
)
View Source
const (
	// OAuthUrlIdentifierKey 构建生成的授权 URL 标识键,用于验证授权来源
	OAuthUrlIdentifierKey = "apple.oauth2.url.identifier.%s"
)

Variables

This section is empty.

Functions

func GetOAuthURLIdentifierKey added in v0.5.17

func GetOAuthURLIdentifierKey(state string) string

Types

type GetPublicKeyResp added in v0.5.17

type GetPublicKeyResp struct {
	Keys []struct {
		Kid string `json:"kid"`
		N   string `json:"n"`
		E   string `json:"e"`
	} `json:"keys"`
}

GetPublicKeyResp 获取公钥响应参数

type OAuth

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

func New

func New(opts ...Option) *OAuth

func (*OAuth) BuildAuthPageURL added in v0.5.17

func (oauth *OAuth) BuildAuthPageURL() (string, error)

func (*OAuth) HandleOAuth2ByAPPAuthToken added in v0.5.17

func (oauth *OAuth) HandleOAuth2ByAPPAuthToken(idToken string) (*plugin.OAuthUser, error)

func (*OAuth) HandleOAuth2ByAuthCode added in v0.5.17

func (oauth *OAuth) HandleOAuth2ByAuthCode(code *plugin.VerifyCode) (*plugin.OAuthUser, error)

func (*OAuth) Provide

func (oauth *OAuth) Provide(ctx context.Context) any

type Option

type Option func(o *Options)

func WithClientID

func WithClientID(clientID string) Option

func WithKeyId

func WithKeyId(keyId string) Option

func WithKeySecret added in v0.5.29

func WithKeySecret(clientSecret string) Option

func WithKeySecretFile added in v0.5.29

func WithKeySecretFile(clientSecretFile string) Option

func WithRedirectURL

func WithRedirectURL(redirectURL string) Option

func WithScope added in v0.5.29

func WithScope(scope ...string) Option

func WithTeamId

func WithTeamId(teamId string) Option

type Options

type Options struct {
	ClientId      string
	KeyId         string
	KeySecret     string
	KeySecretFile string
	TeamId        string
	RedirectURL   string
	Scopes        []string
}

Jump to

Keyboard shortcuts

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