-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite auth to use new client interface. Add new auth client for loc…
…al web authentication.
- Loading branch information
Showing
11 changed files
with
363 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package client | ||
|
||
import ( | ||
"sync" | ||
"time" | ||
) | ||
|
||
// Client is an interface which all client types abide by. It guarantees operations around | ||
// credentials; primarily getting, initializing, and refreshing. | ||
type Client interface { | ||
Credentials() *RequestCredentials | ||
|
||
// InitializeCredentials should make the initial requests necessary to establish the first set of | ||
// authentication credentials within the Client. | ||
InitializeCredentials() error | ||
|
||
// RefreshCredentials should initiate an internal refresh of the request credentials inside this | ||
// client. This refresh should, whenever possible, check the | ||
// RequestCredentials.AccessTokenExpiresAt field to determine whether it should actually refresh | ||
// the credentials or if the credentials are still valid. | ||
RefreshCredentials() error | ||
} | ||
|
||
// RequestCredentials stores all the information necessary to authenticate a request with the | ||
// Microsoft GraphAPI | ||
type RequestCredentials struct { | ||
AccessToken string | ||
AccessTokenExpiresAt time.Time | ||
AccessTokenUpdating sync.Mutex | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Package client implements client state, authentication, pagination, type helpers, and method | ||
// helpers concerning accessing resources in the Microsoft Graph API. | ||
package client |
Oops, something went wrong.