auth

package
v0.0.0-...-4c6bba2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auther

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

Auther enc/dec sensitive data

func GetAuther

func GetAuther(conf config.CnfAuth) (*Auther, error)

GetAuther initiates cipher, connection

func (*Auther) BuildJWT

func (a *Auther) BuildJWT(o *JWTInfo) (string, error)

BuildJWT returns JSON Web Token of player

func (*Auther) Decrypt

func (a *Auther) Decrypt(enc64 string) string

Decrypt returns plain text from AES and Base64 encoded string.

func (*Auther) Digest

func (a *Auther) Digest(plain string) string

Digest returns hash value of plain

func (*Auther) Encrypt

func (a *Auther) Encrypt(plain string) string

Encrypt returns AES and Base64 encoded string.

func (*Auther) GetGitHubAuthURL

func (a *Auther) GetGitHubAuthURL() string

GetGitHubAuthURL returns auth url

func (*Auther) GetGitHubOAuthInfo

func (a *Auther) GetGitHubOAuthInfo(resState string, code string) (*OAuthInfo, error)

GetGitHubOAuthInfo returns user info

func (*Auther) GetGoogleAuthURL

func (a *Auther) GetGoogleAuthURL() string

GetGoogleAuthURL returns auth url

func (*Auther) GetGoogleOAuthInfo

func (a *Auther) GetGoogleOAuthInfo(resState string, code string) (*OAuthInfo, error)

GetGoogleOAuthInfo returns user info

func (*Auther) GetTwitterAuthURL

func (a *Auther) GetTwitterAuthURL() (*oauth.Credentials, string, error)

GetTwitterAuthURL returns auth url

func (*Auther) GetTwitterOAuthInfo

func (a *Auther) GetTwitterOAuthInfo(tmpCred *oauth.Credentials, tmpSecret string) (*OAuthInfo, error)

GetTwitterOAuthInfo returns user info

type JWTInfo

type JWTInfo struct {
	ID    uint
	Name  string
	Image string
	Admin bool
	Hue   int
}

JWTInfo is requirements to create json web token

type OAuthInfo

type OAuthInfo struct {
	Handler     *Auther
	DisplayName string
	Image       string
	LoginID     string
	OAuthToken  string
	OAuthSecret string
	IsEnc       bool
}

OAuthInfo represents infomation from OAuth App

func (*OAuthInfo) Dec

func (i *OAuthInfo) Dec() (*OAuthInfo, error)

Dec returns decrypted info

func (*OAuthInfo) Enc

func (i *OAuthInfo) Enc() (*OAuthInfo, error)

Enc returns encrypted info

func (*OAuthInfo) IsValid

func (i *OAuthInfo) IsValid() bool

IsValid returns whether OAuthToken exists or not

Jump to

Keyboard shortcuts

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