| 85 | } |
| 86 | |
| 87 | func GetAccessToken(tenant string) (string, error) { |
| 88 | var accessToken string |
| 89 | |
| 90 | for i := 0; i < secretAccessTokenMaxChunks; i++ { |
| 91 | a, err := keyring.Get(fmt.Sprintf("%s %d", secretAccessToken, i), tenant) |
| 92 | // Only return if we have pulled more than 1 item from the keyring, otherwise this will be |
| 93 | // a valid "secret not found in keyring". |
| 94 | if err == keyring.ErrNotFound && i > 0 { |
| 95 | return accessToken, nil |
| 96 | } |
| 97 | if err != nil { |
| 98 | return "", err |
| 99 | } |
| 100 | accessToken += a |
| 101 | } |
| 102 | |
| 103 | return accessToken, nil |
| 104 | } |
| 105 | |
| 106 | func chunk(slice string, chunkSize int) []string { |
| 107 | var chunks []string |