Skip to content

Commit 023a0fb

Browse files
authored
feat: increase token expiration check visibility (#424)
1 parent 4315a61 commit 023a0fb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

bluemix/configuration/core_config/bx_config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,18 +313,18 @@ func (c *bxConfig) IAMID() (guid string) {
313313
func (c *bxConfig) IsLoggedIn() bool {
314314
if token, refresh := c.IAMToken(), c.IAMRefreshToken(); token != "" || refresh != "" {
315315
iamTokenInfo := NewIAMTokenInfo(token)
316-
if iamTokenInfo.hasExpired() && refresh != "" {
316+
if iamTokenInfo.HasExpired() && refresh != "" {
317317
repo := newRepository(c)
318318
if _, err := repo.RefreshIAMToken(); err != nil {
319319
return false
320320
}
321321
// Check again to make sure that the new token has not expired
322-
if iamTokenInfo = NewIAMTokenInfo(c.IAMToken()); iamTokenInfo.hasExpired() {
322+
if iamTokenInfo = NewIAMTokenInfo(c.IAMToken()); iamTokenInfo.HasExpired() {
323323
return false
324324
}
325325

326326
return true
327-
} else if iamTokenInfo.hasExpired() && refresh == "" {
327+
} else if iamTokenInfo.HasExpired() && refresh == "" {
328328
return false
329329
} else {
330330
return true

bluemix/configuration/core_config/iam_token.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (t IAMTokenInfo) exists() bool {
9393
return t.ID != ""
9494
}
9595

96-
func (t IAMTokenInfo) hasExpired() bool {
96+
func (t IAMTokenInfo) HasExpired() bool {
9797
if !t.exists() {
9898
return true
9999
}

bluemix/configuration/core_config/iam_token_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func TestIAMTokenHasExpired(t *testing.T) {
9898
for _, testCase := range TestIAMTokenHasExpiredTestCases {
9999
t.Run(testCase.name, func(t *testing.T) {
100100
tokenInfo := NewIAMTokenInfo(testCase.token)
101-
assert.Equal(t, testCase.isExpired, tokenInfo.hasExpired())
101+
assert.Equal(t, testCase.isExpired, tokenInfo.HasExpired())
102102
})
103103
}
104104
}

0 commit comments

Comments
 (0)