Skip to content

Commit

Permalink
deprecate initauth
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Oct 29, 2022
1 parent b37570e commit 1da7ad5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions internal/app/appauth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,26 @@ type Credentials interface {
// returns the auth provider according to the type of credentials determined
// by creds.AuthProvider, and saves them to an AES-256-CFB encrypted storage.
//
// The storage is encrypted using the hash of the unique machine-ID, supplied
// by the operating system (see package encio), it makes it impossible to
// transfer and use the stored credentials on another machine (including
// virtual), even another operating system on the same machine, unless it's a
// clone of the source operating system on which the credentials storage was
// created.
// The storage is encrypted using the hash of the unique machine-ID, supplied by
// the operating system (see package encio), it makes it impossible use the
// stored credentials on another machine (including virtual), even another
// operating system on the same machine, unless it's a clone of the source
// operating system on which the credentials storage was created.
//
// Deprecated: Use Manager.Auth.
func InitProvider(ctx context.Context, cacheDir string, workspace string, creds Credentials) (auth.Provider, error) {
return initProvider(ctx, cacheDir, defCredsFile, workspace, creds)
}

func initProvider(ctx context.Context, cacheDir string, filename string, workspace string, creds Credentials) (auth.Provider, error) {
ctx, task := trace.NewTask(ctx, "InitProvider")
defer task.End()

if err := os.MkdirAll(cacheDir, 0700); err != nil {
return nil, fmt.Errorf("failed to create cache directory: %w", err)
}

credsLoc := filepath.Join(cacheDir, defCredsFile)
credsLoc := filepath.Join(cacheDir, filename)

// try to load the existing credentials, if saved earlier.
if creds.IsEmpty() {
Expand Down

0 comments on commit 1da7ad5

Please sign in to comment.