mirror of
https://github.com/volatiletech/authboss.git
synced 2024-11-24 08:42:17 +02:00
Rename OAuthProvider to OAuth2Provider
- Add more docs.
This commit is contained in:
parent
090ce2b6c3
commit
47d9dc66f8
10
oauth2.go
10
oauth2.go
@ -11,7 +11,7 @@ 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 oauth2 module.
|
||||
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
|
||||
@ -25,8 +25,14 @@ The UID must be passed back or there will be an error as it is the means of iden
|
||||
user in the system, e-mail is optional but should be returned in systems using
|
||||
emailing. The keys authboss.StoreOAuth2UID and authboss.StoreEmail can be used to set
|
||||
these values in the authboss.Attributes map returned by the callback.
|
||||
|
||||
In addition to the required values mentioned above any additional
|
||||
values that you wish to have in your user struct can be included here, such as the
|
||||
Name of the user at the endpoint. Keep in mind that only types that are valid for the
|
||||
Attributes type should be used: string, bool, time.Time, int64, or any type that implements
|
||||
database/driver.Valuer.
|
||||
*/
|
||||
type OAuthProvider struct {
|
||||
type OAuth2Provider struct {
|
||||
OAuth2Config *oauth2.Config
|
||||
AdditionalParams url.Values
|
||||
Callback func(oauth2.Config, *oauth2.Token) (Attributes, error)
|
||||
|
@ -17,8 +17,8 @@ import (
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
)
|
||||
|
||||
var testProviders = map[string]authboss.OAuthProvider{
|
||||
"google": authboss.OAuthProvider{
|
||||
var testProviders = map[string]authboss.OAuth2Provider{
|
||||
"google": authboss.OAuth2Provider{
|
||||
OAuth2Config: &oauth2.Config{
|
||||
ClientID: `jazz`,
|
||||
ClientSecret: `hands`,
|
||||
@ -154,8 +154,8 @@ func TestOAuthSuccess(t *testing.T) {
|
||||
return fakeToken, nil
|
||||
}
|
||||
|
||||
cfg.OAuth2Providers = map[string]authboss.OAuthProvider{
|
||||
"fake": authboss.OAuthProvider{
|
||||
cfg.OAuth2Providers = map[string]authboss.OAuth2Provider{
|
||||
"fake": authboss.OAuth2Provider{
|
||||
OAuth2Config: &oauth2.Config{
|
||||
ClientID: `jazz`,
|
||||
ClientSecret: `hands`,
|
||||
|
Loading…
Reference in New Issue
Block a user