From fbac1b1e860f8b8f1aed3f9cde12d5efb331914a Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Wed, 20 Apr 2016 22:12:14 +0100 Subject: Add comments. --- server/auth/provider.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'server/auth/provider.go') 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 { -- cgit v1.2.3