oauth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Google = &googleProvider{}

Google is the google auth Provider.

View Source
var (
	// ProvidersList is the list of all the providers configured for the API
	// server, this is populated by ConfigureProviders function.
	ProvidersList []Provider
)

Functions

func ConfigureProviders

func ConfigureProviders()

ConfigureProviders configures all the provider available and registers them in the ProvidersList.

Types

type Provider

type Provider interface {
	// Type returns the type of provider.
	Type() ProviderType

	// Configured checks if the provider is configured or not.
	Configured() bool

	// Configure helps us to initialize any variables or setup requirements.
	Configure()

	// GetLoginURL returns the URL which redirects user to the providers login page.
	GetLoginURL() string

	// GetUser gets the user after requesting the OAuth provider.
	// Returns the user, status code and error if any.
	GetUser(*gin.Context) (*User, int, error)
}

Provider is an interface that represents any provider through which we can authenticate a user on the application.

type ProviderType

type ProviderType string

ProviderType for different OAuth Providers supported in xene

type User

type User struct {
	Profile string `json:"profile"`
	Email   string `json:"email"`
}

User represents the user details required from the oauth provider.

Jump to

Keyboard shortcuts

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