diff options
author | Ben Burwell <ben@benburwell.com> | 2020-04-13 23:57:13 -0400 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2020-04-13 23:57:13 -0400 |
commit | 2ce3b86e0ff69538935db3149d1ed2f24aea09a3 (patch) | |
tree | 1c0329a5c1191690e57e7160bd3150c9a2851866 /server/auth/testprovider/testprovider.go | |
parent | 8b1ee3e95010681d98d1b31af98f0ce0832cedd2 (diff) |
Simplify
Diffstat (limited to 'server/auth/testprovider/testprovider.go')
-rw-r--r-- | server/auth/testprovider/testprovider.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/server/auth/testprovider/testprovider.go b/server/auth/testprovider/testprovider.go deleted file mode 100644 index f785081..0000000 --- a/server/auth/testprovider/testprovider.go +++ /dev/null @@ -1,56 +0,0 @@ -package testprovider - -import ( - "time" - - "github.com/nsheridan/cashier/server/auth" - - "golang.org/x/oauth2" -) - -const ( - name = "testprovider" -) - -// Config is an implementation of `auth.Provider` for testing. -type Config struct{} - -var _ auth.Provider = (*Config)(nil) - -// New creates a new provider. -func New() *Config { - return &Config{} -} - -// Name returns the name of the provider. -func (c *Config) Name() string { - return name -} - -// Valid validates the oauth token. -func (c *Config) Valid(token *oauth2.Token) bool { - return true -} - -// Revoke disables the access token. -func (c *Config) Revoke(token *oauth2.Token) error { - return nil -} - -// StartSession retrieves an authentication endpoint. -func (c *Config) StartSession(state string) string { - return "https://www.example.com/auth" -} - -// Exchange authorizes the session and returns an access token. -func (c *Config) Exchange(code string) (*oauth2.Token, error) { - return &oauth2.Token{ - AccessToken: "token", - Expiry: time.Now().Add(1 * time.Hour), - }, nil -} - -// Username retrieves the username portion of the user's email address. -func (c *Config) Username(token *oauth2.Token) string { - return "test" -} |