diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-04-20 22:12:14 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-04-20 22:12:14 +0100 |
commit | fbac1b1e860f8b8f1aed3f9cde12d5efb331914a (patch) | |
tree | 25a2fafe0e5bc517a29738b8b9a081fd735c988b /server/auth/provider.go | |
parent | c7350ab6f1d8054d1bc6d2d14d071010bfb0e92f (diff) |
Add comments.
Diffstat (limited to 'server/auth/provider.go')
-rw-r--r-- | server/auth/provider.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/server/auth/provider.go b/server/auth/provider.go index ae512bd..d7d5ed5 100644 --- a/server/auth/provider.go +++ b/server/auth/provider.go @@ -2,6 +2,7 @@ package auth import "golang.org/x/oauth2" +// Provider is an abstraction of different auth methods. type Provider interface { Name() string StartSession(string) *Session @@ -11,12 +12,15 @@ type Provider interface { Revoke(*oauth2.Token) error } +// Session stores authentication state. type Session struct { AuthURL string Token *oauth2.Token State string } +// Authorize obtains data from the provider and retains an access token that +// can be stored for later access. func (s *Session) Authorize(provider Provider, code string) error { t, err := provider.Exchange(code) if err != nil { |