apple

package
v0.5.42 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 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

func GetOAuthURLIdentifierKey(state string) string

Types

type GetPublicKeyResp

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

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

func (*OAuth) HandleOAuth2ByAPPAuthToken

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

func (*OAuth) HandleOAuth2ByAuthCode

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

func WithKeySecret(clientSecret string) Option

func WithKeySecretFile

func WithKeySecretFile(clientSecretFile string) Option

func WithRedirectURL

func WithRedirectURL(redirectURL string) Option

func WithScope

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