forked from Azure/fleet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move file from interfaces to authtoken package directories …
…and add comments (Azure#938) * move interfaces.go from interfaces to authtoken/providers directory and add commenting * Edit comments * Rename structs, add periods to comments and update AuthToken comment * remove pkg/interfaces to be copied from go source * Ran goimports -w on files in pkg/authtoken/providers/ directory * Elaborate commenting for documentation * Reorder imports by moving fleet pkgs to the bottom
- Loading branch information
Showing
10 changed files
with
57 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Copyright (c) Microsoft Corporation. | ||
Licensed under the MIT license. | ||
*/ | ||
package authtoken | ||
|
||
import ( | ||
"context" | ||
"time" | ||
) | ||
|
||
// An AuthToken is an authentication token used to communicate with the hub API server. | ||
type AuthToken struct { | ||
Token string // The authentication token string. | ||
ExpiresOn time.Time // The expiration time of the token. | ||
} | ||
|
||
// Provider defines a method for fetching an authentication token. | ||
type Provider interface { | ||
// FetchToken fetches an authentication token to make requests to its associated fleet's hub cluster. | ||
// It returns the token for a given input context, or an error if the retrieval fails. | ||
FetchToken(ctx context.Context) (AuthToken, error) | ||
} | ||
|
||
// Writer defines a method for writing an authentication token to a specified location. | ||
type Writer interface { | ||
// WriteToken writes the provided authentication token to a filepath location specified in a TokenWriter. | ||
// It returns an error if the writing process fails. | ||
WriteToken(token AuthToken) error | ||
} |
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
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.