auth

package
v0.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const GITHUB_ACCESS_TOKEN_URL = "https://github.com/login/oauth/access_token"
View Source
const GITHUB_USER_URL = "https://api.github.com/user"

Variables

This section is empty.

Functions

func NewGithub

func NewGithub(cfg map[string]string) server.AuthProvider

func NewGoogle

func NewGoogle(cfg map[string]string) server.AuthProvider

func NewLocal

func NewLocal(cfg map[string]string) server.AuthProvider

func NewTwitter

func NewTwitter(cfg map[string]string) server.AuthProvider

Types

type AuthAuthProvider

type AuthAuthProvider struct {
}

func (*AuthAuthProvider) Callback

func (g *AuthAuthProvider) Callback(c server.Context) (*entities.User, error)

func (*AuthAuthProvider) Login

func (g *AuthAuthProvider) Login(c server.Context) error

func (*AuthAuthProvider) Name

func (g *AuthAuthProvider) Name() string

type GithubAccessTokenResponse

type GithubAccessTokenResponse struct {
	Scope       string `json:"scope"`
	TokenType   string `json:"token_type"`
	AccessToken string `json:"access_token"`
}

type GithubAuthProvider

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

func (*GithubAuthProvider) Callback

func (g *GithubAuthProvider) Callback(c server.Context) (u *entities.User, err error)

func (*GithubAuthProvider) GetGithubAccessToken

func (g *GithubAuthProvider) GetGithubAccessToken(code string) (string, error)

func (*GithubAuthProvider) GetGithubUser

func (g *GithubAuthProvider) GetGithubUser(accessToken string) (*GithubUserResponse, error)

func (*GithubAuthProvider) GetGithubUserFromAccessCode

func (g *GithubAuthProvider) GetGithubUserFromAccessCode(code string) (*GithubUserResponse, error)

func (*GithubAuthProvider) Login

func (g *GithubAuthProvider) Login(c server.Context) error

func (*GithubAuthProvider) Name

func (g *GithubAuthProvider) Name() string

type GithubUserResponse

type GithubUserResponse struct {
	Login     string `json:"login"`
	ID        int    `json:"id"`
	AvatarURL string `json:"avatar_url"`
	Name      string `json:"name"`
	Blog      string `json:"blog"`
	Email     string `json:"email"`
	Bio       string `json:"bio"`
}

type GoogleAuthProvider

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

func (*GoogleAuthProvider) Callback

func (g *GoogleAuthProvider) Callback(c server.Context) (u *entities.User, err error)

func (*GoogleAuthProvider) GetGoogleUserFromAccessCode

func (g *GoogleAuthProvider) GetGoogleUserFromAccessCode(code string) (*GoogleUserResponse, error)

func (*GoogleAuthProvider) Login

func (g *GoogleAuthProvider) Login(c server.Context) error

func (*GoogleAuthProvider) Name

func (g *GoogleAuthProvider) Name() string

type GoogleUserResponse

type GoogleUserResponse struct {
	ID      string `json:"id"`
	Email   string `json:"email"`
	Name    string `json:"name"`
	Picture string `json:"picture"`
}

type LoginData

type LoginData struct {
	Login    string `json:"login"`
	Password string `json:"password"`
}

type TwitterAuthProvider

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

func (*TwitterAuthProvider) Callback

func (g *TwitterAuthProvider) Callback(c server.Context) (u *entities.User, err error)

func (*TwitterAuthProvider) Login

func (*TwitterAuthProvider) Name

func (g *TwitterAuthProvider) Name() string

type TwitterUserResponse

type TwitterUserResponse struct {
	ID                   int    `json:"id"`
	IDStr                string `json:"id_str"`
	Name                 string `json:"name"`
	ScreenName           string `json:"screen_name"`
	Email                string `json:"email"`
	ProfileImageUrlHttps string `json:"profile_image_url_https"`
}

Jump to

Keyboard shortcuts

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