oauth

package
Version: v0.0.0-...-16621ce Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package oauth package to manage extensions of the oauth protocol for oauth oAuthProviders

Package oauth package to manage extensions of the oauth protocol for oauth oAuthProviders

Package oauth package to manage extensions of the oauth protocol for oauth oAuthProviders

Package oauth package to manage extensions of the oauth protocol for oauth oAuthProviders

Index

Constants

View Source
const (
	// ServiceGoogle google service enum
	ServiceGoogle = ServiceType("google")

	// ServiceGithub github service enum
	ServiceGithub = ServiceType("github")

	// ServiceGitlab gitlab service enum
	ServiceGitlab = ServiceType("gitlab")
)

Variables

ServicesAutorize get service config

ServicesCallback callback process by service

ServicesConfigs get service config

Functions

func AuthorizeByService

func AuthorizeByService(w rest.ResponseWriter, r *rest.Request)

AuthorizeByService use service to autorize

func GetGithubConfig

func GetGithubConfig() *oauth2.Config

GetGithubConfig get configuration from return URL

func GetGitlabConfig

func GetGitlabConfig() *oauth2.Config

GetGitlabConfig get configuration from return URL

func GetGoogleConfig

func GetGoogleConfig() *oauth2.Config

GetGoogleConfig get configuration from return URL

func GithubAuthorize

func GithubAuthorize(redirectURI string, config *oauth2.Config, w rest.ResponseWriter, r *rest.Request)

GithubAuthorize use google to authorize user

func GitlabAuthorize

func GitlabAuthorize(redirectURI string, config *oauth2.Config, w rest.ResponseWriter, r *rest.Request)

GitlabAuthorize use google to authorize user

func GoogleAuthorize

func GoogleAuthorize(redirectURI string, config *oauth2.Config, w rest.ResponseWriter, r *rest.Request)

GoogleAuthorize use google to authorize user

Types

type AuthorizeServiceFunc

type AuthorizeServiceFunc func(redirectURI string, config *oauth2.Config, w rest.ResponseWriter, r *rest.Request)

AuthorizeServiceFunc use service authorization method

type CallbackServiceFunc

type CallbackServiceFunc func(config *oauth2.Config, code string) (*ResponsePayload, error)

CallbackServiceFunc use service authorization method

type Config

type Config struct {
}

Config oauth configuration

type GetServiceConfigFunc

type GetServiceConfigFunc func() *oauth2.Config

GetServiceConfigFunc get service configuration

type ResponsePayload

type ResponsePayload struct {
	Nick       string      `json:"nick"`
	Email      string      `json:"email"`
	RedirectTo string      `json:"redirect_uri"`
	Raw        string      `json:"raw"`
	Service    ServiceType `json:"service_type"`
}

ResponsePayload oauth response payload

func CbByService

func CbByService(r *rest.Request) (*ResponsePayload, error)

CbByService use service callback

func GithubCb

func GithubCb(config *oauth2.Config, code string) (*ResponsePayload, error)

GithubCb use code to retrive service user data

func GitlabCb

func GitlabCb(config *oauth2.Config, code string) (*ResponsePayload, error)

GitlabCb use code to retrive service user data

func GoogleCb

func GoogleCb(config *oauth2.Config, code string) (*ResponsePayload, error)

GoogleCb use code to retrive service user data

type ServiceType

type ServiceType string

ServiceType type of service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL