-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate AuthN and AuthZ into Quarterdeck (#93)
- Loading branch information
Showing
6 changed files
with
75 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package api | ||
|
||
// Credentials provides a basic interface for loading an access token from Quarterdeck | ||
// into the Quarterdeck API client. Credentials can be loaded from disk, generated, or | ||
// feched from a passthrough request. | ||
type Credentials interface { | ||
AccessToken() (string, error) | ||
} | ||
|
||
// A Token is just the JWT base64 encoded token string that is obtained from | ||
// Quarterdeck either using the authtest server or from a login with the client. | ||
type Token string | ||
|
||
// Token implements the credentials interface and performs limited validation. | ||
func (t Token) AccessToken() (string, error) { | ||
if string(t) == "" { | ||
return "", ErrInvalidCredentials | ||
} | ||
return string(t), nil | ||
} |
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 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