Skip to content

Commit ce7e550

Browse files
committed
chore: add IsAuthenticated to reduce duplicates
1 parent 33cc519 commit ce7e550

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/comdirect/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ func (c *Client) GetAuthentication() *Authentication {
135135
return c.authentication
136136
}
137137

138+
func (c *Client) IsAuthenticated() bool {
139+
return c.authentication != nil && c.authentication.accessToken.AccessToken != "" && !c.authentication.IsExpired()
140+
}
141+
138142
// Revoke uses the underlying Authenticator to revoke an access token.
139143
func (c *Client) Revoke() error {
140144
if c.authenticator == nil {

0 commit comments

Comments
 (0)