goauthboss

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

package goauthboss provides an Init method to integrate with authboss.

Most of the code comes from https://github.com/volatiletech/authboss/blob/bf1c58d588380d4b75cd548db488c441fe73593a/oauth2/oauth2.go (Copyright (c) 2015 Kris Runzer, Aaron Lefkowitz - licensed under the MIT License).

Index

Constants

View Source
const (
	FormValueOAuth2State = "state"
	FormValueOAuth2Redir = "redir"
)

FormValue constants

Variables

This section is empty.

Functions

func Init

func Init(ab *authboss.Authboss, providers map[string]goath.Provider, store OAuth2Store) error

Init will register the providers with authboss. The callback uri will be "/oauth2/callback/" + nameOfTheProvider (key of the map).

Types

type OAuth2Result added in v0.1.4

type OAuth2Result struct {
	Provider string
	// UnmarshalUser will unmarshal the JSON user returned by the provider
	//      var user struct {
	//      	ID    string `json:"sub"`
	//      	Email string `json:"email"`
	//      	Name  string `json:"name"`
	//      }
	//      err = UnmarshalUser(&user)
	UnmarshalUser func(interface{}) error
	Token         *oauth2.Token
}

type OAuth2Store

type OAuth2Store interface {
	FindOrCreateOAuth2User(context.Context, OAuth2Result) (authboss.User, error)
}

Jump to

Keyboard shortcuts

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