Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure Token and Expiry can be set properly #1067

Merged
merged 1 commit into from Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 4 additions & 15 deletions pkg/credentials/sts_client_grants.go
Expand Up @@ -60,19 +60,8 @@ type ClientGrantsResult struct {

// ClientGrantsToken - client grants token with expiry.
type ClientGrantsToken struct {
token string
expiry int
}

// Token - access token returned after authenticating client grants.
func (c *ClientGrantsToken) Token() string {
return c.token
}

// Expiry - expiry for the access token returned after authenticating
// client grants.
func (c *ClientGrantsToken) Expiry() string {
return fmt.Sprintf("%d", c.expiry)
Token string
Expiry int
}

// A STSClientGrants retrieves credentials from Minio service, and keeps track if
Expand Down Expand Up @@ -123,8 +112,8 @@ func getClientGrantsCredentials(clnt *http.Client, endpoint string,

v := url.Values{}
v.Set("Action", "AssumeRoleWithClientGrants")
v.Set("Token", accessToken.Token())
v.Set("DurationSeconds", accessToken.Expiry())
v.Set("Token", accessToken.Token)
v.Set("DurationSeconds", fmt.Sprintf("%d", accessToken.Expiry))
v.Set("Version", "2011-06-15")

u, err := url.Parse(endpoint)
Expand Down
19 changes: 4 additions & 15 deletions pkg/credentials/sts_web_identity.go
Expand Up @@ -53,19 +53,8 @@ type WebIdentityResult struct {

// WebIdentityToken - web identity token with expiry.
type WebIdentityToken struct {
token string
expiry int
}

// Token - access token returned after authenticating web identity.
func (c *WebIdentityToken) Token() string {
return c.token
}

// Expiry - expiry for the access token returned after authenticating
// web identity.
func (c *WebIdentityToken) Expiry() string {
return fmt.Sprintf("%d", c.expiry)
Token string
Expiry int
}

// A STSWebIdentity retrieves credentials from Minio service, and keeps track if
Expand Down Expand Up @@ -115,8 +104,8 @@ func getWebIdentityCredentials(clnt *http.Client, endpoint string,

v := url.Values{}
v.Set("Action", "AssumeRoleWithWebIdentity")
v.Set("WebIdentityToken", idToken.Token())
v.Set("DurationSeconds", idToken.Expiry())
v.Set("WebIdentityToken", idToken.Token)
v.Set("DurationSeconds", fmt.Sprintf("%d", idToken.Expiry))
v.Set("Version", "2011-06-15")

u, err := url.Parse(endpoint)
Expand Down