oauth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AuthCodeStateName = "click-ci-core"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthInfo

type AuthInfo struct {
	Method          AuthMethod      `json:"method" yaml:"method"`
	ID              *string         `json:"id,omitempty" yaml:"id,omitempty"`
	Secret          *string         `json:"secret,omitempty" yaml:"secret,omitempty"`
	User            *string         `json:"user,omitempty" yaml:"user,omitempty"`
	Password        *string         `json:"password,omitempty" yaml:"password,omitempty"`
	RsaPEMKeyPair   *crypto.KeyPair `json:"rsa_pem_key_pair,omitempty" yaml:"rsa_pem_key_pair,omitempty"`
	RequestTokenURL *string         `json:"request_token_url,omitempty" yaml:"request_token_url,omitempty"`
	AuthorizeURL    *string         `json:"authorize_url,omitempty" yaml:"authorize_url,omitempty"`
	RedirectURL     *string         `json:"redirect_url,omitempty" yaml:"redirect_url,omitempty"`
	AccessTokenURL  *string         `json:"access_token_url,omitempty" yaml:"access_token_url,omitempty"`
}

func (AuthInfo) IsTokenAuth

func (a AuthInfo) IsTokenAuth() bool

type AuthMethod

type AuthMethod string
const (
	AM_OAuth_AuthCode  AuthMethod = "OAuthCode"
	AM_OAuth_CredToken AuthMethod = "OAuthCredToken"
	AM_AppPassword     AuthMethod = "AppPassword"
	AM_OAuth1_RSA      AuthMethod = "OAuth1RSA"
)

type Config

type Config struct {
	Ctx           context.Context `json:"-" yaml:"-"`
	Cfg           *oauth2.Config  `json:"-" yaml:"-"`
	Token         *oauth2.Token   `json:"oauth_token,omitempty" yaml:"oauth_token,omitempty"`
	CfgVer1       *oauth1.Config  `json:"-" yaml:"-"`
	TokenVer1     *oauth1.Token   `json:"oauth_token_ver1,omitempty" yaml:"oauth_token_ver1,omitempty"`
	Auth          AuthInfo        `json:"auth_info" yaml:"auth_info"`
	RsaPEMKeyPair *crypto.KeyPair `json:"rsa_pem_key_pair,omitempty" yaml:"rsa_pem_key_pair,omitempty"`
}

func NewConfig

func NewConfig(auth AuthInfo) *Config

func (*Config) AuthCodeURL

func (c *Config) AuthCodeURL() (string, *util.Result)

func (*Config) AuthRequest

func (c *Config) AuthRequest(r *http.Request)

func (*Config) CredentialToken

func (c *Config) CredentialToken() (*oauth2.Token, error)

func (*Config) Exchange

func (c *Config) Exchange(code string) (*oauth2.Token, error)

type User

type User struct {
	UserName    *string `json:"username,omitempty"`
	DisplayName *string `json:"display_name,omitempty"`
	AccountID   *string `json:"account_id,omitempty"`
	UUID        *string `json:"uuid,omitempty"`
	ID          *int64  `json:"id,omitempty"`
}

Jump to

Keyboard shortcuts

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