oauth

package
v0.0.0-...-a97d171 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const UserAgent = "globalsteam.online"

Variables

View Source
var Providers = []Provider{
	&steamProvider{},
	&discordProvider{},
	&twitchProvider{},
	&battlenetProvider{},
	&googleProvider{},
	&twitterProvider{},
	&redditProvider{},
	&patreonProvider{},
	&githubProvider{},
}

In order for frontend

Functions

This section is empty.

Types

type BattlenetUser

type BattlenetUser struct {
	Sub       string `json:"sub"`
	ID        int    `json:"id"`
	Battletag string `json:"battletag"`
}

type GithubUser

type GithubUser struct {
	Name      string `json:"name"`
	Email     string `json:"email"`
	AvatarURL string `json:"avatar_url"`
	ID        int64  `json:"id"`
}

type GoogleUser

type GoogleUser struct {
	Sub     string `json:"sub"`
	Name    string `json:"name"`
	Picture string `json:"picture"`
	Email   string `json:"email"`
}

type OAuth1Provider

type OAuth1Provider interface {
	Provider
	GetConfig() oauth1.Config
	GetUser(*oauth1.Token) (User, error)
	Redirect() (string, string, error)
}

type OAuth2Provider

type OAuth2Provider interface {
	Provider
	GetConfig() oauth2.Config
	GetUser(*oauth2.Token) (User, error)
	Redirect(http.ResponseWriter, *http.Request, string)
}

type OpenIDProvider

type OpenIDProvider interface {
	Provider
	GetUser(*http.Request) (User, error)
	Redirect(http.ResponseWriter, *http.Request, string)
}

type PatreonUser

type PatreonUser struct {
	Data struct {
		Attributes struct {
			Email    string `json:"email"`
			FullName string `json:"full_name"`
			ImageURL string `json:"image_url"`
		} `json:"attributes"`
		ID string `json:"id"`
	} `json:"data"`
}

type Provider

type Provider interface {
	GetName() string
	GetIcon() string
	GetColour() string
	GetEnum() ProviderEnum
	GetType() ProviderType
	HasEmail() bool
}

func New

func New(p ProviderEnum) Provider

type ProviderEnum

type ProviderEnum string
var (
	ProviderDiscord   ProviderEnum = "discord"
	ProviderGoogle    ProviderEnum = "google"
	ProviderGithub    ProviderEnum = "github"
	ProviderTwitch    ProviderEnum = "twitch"
	ProviderBattlenet ProviderEnum = "battlenetus"
	ProviderReddit    ProviderEnum = "reddit"
	ProviderPatreon   ProviderEnum = "patreon"
	ProviderSteam     ProviderEnum = "steam"
	ProviderTwitter   ProviderEnum = "twitter"
)

type ProviderType

type ProviderType uint8
const (
	TypeOAuth ProviderType = iota
	TypeOpenID
)

type RedditUser

type RedditUser struct {
	ID      string `json:"id"`
	IconImg string `json:"icon_img"`
	Name    string `json:"name"`
}

type TwitchUser

type TwitchUser struct {
	Data []struct {
		ID              string `json:"id"`
		Login           string `json:"login"`
		DisplayName     string `json:"display_name"`
		Type            string `json:"type"`
		BroadcasterType string `json:"broadcaster_type"`
		Description     string `json:"description"`
		ProfileImageURL string `json:"profile_image_url"`
		OfflineImageURL string `json:"offline_image_url"`
		ViewCount       int    `json:"view_count"`
		Email           string `json:"email"`
	} `json:"data"`
}

type User

type User struct {
	Token    string
	ID       string
	Username string
	Email    string
	Avatar   string
}

Jump to

Keyboard shortcuts

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