1
0
mirror of https://github.com/volatiletech/authboss.git synced 2024-11-24 08:42:17 +02:00
authboss/oauth2.go
Aaron L 1112987bce Rewrite oauth module
- Tried to be clear about OAuth2 vs OAuth in all places.
- Allow users to be locked from OAuth logins (if done manually for some
  reason other than failed logins)
- Cleaned up some docs and wording around the previously very confusing
  (now hopefully only somewhat confusing) oauth2 module.
2018-03-08 18:39:51 -08:00

32 lines
1.1 KiB
Go

package authboss
import (
"context"
"net/url"
"golang.org/x/oauth2"
)
/*
OAuth2Provider is the entire configuration
required to authenticate with this provider.
The OAuth2Config does not need a redirect URL because it will
be automatically created by the route registration in the oauth2 module.
AdditionalParams can be used to specify extra parameters to tack on to the
end of the initial request, this allows for provider specific oauth options
like access_type=offline to be passed to the provider.
FindUserDetails gives the config and the token allowing an http client using the
authenticated token to be created, a call is then made to a known endpoint that will
return details about the user we've retrieved the token for. Those details are returned
as a map[string]string and subsequently passed into OAuth2ServerStorer.NewFromOAuth2.
API this must be handled for each provider separately.
*/
type OAuth2Provider struct {
OAuth2Config *oauth2.Config
AdditionalParams url.Values
FindUserDetails func(context.Context, oauth2.Config, *oauth2.Token) (map[string]string, error)
}