mirror of
https://github.com/LukeHagar/sailpoint-cli.git
synced 2025-12-06 04:21:15 +00:00
Corrected config errors during expiry retrieval
This commit is contained in:
@@ -142,6 +142,7 @@ func InitConfig() error {
|
|||||||
|
|
||||||
if GetDebug() {
|
if GetDebug() {
|
||||||
log.SetLevel(log.DebugLevel)
|
log.SetLevel(log.DebugLevel)
|
||||||
|
log.SetReportCaller(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -157,13 +158,14 @@ func InitAPIClient() (*sailpoint.APIClient, error) {
|
|||||||
|
|
||||||
token, err := GetAuthToken()
|
token, err := GetAuthToken()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug("unable to retrieve accesstoken: %s ", err)
|
log.Debug("unable to retrieve accesstoken", "error", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration := sailpoint.NewConfiguration(sailpoint.ClientConfiguration{Token: token, BaseURL: GetBaseUrl()})
|
configuration := sailpoint.NewConfiguration(sailpoint.ClientConfiguration{Token: token, BaseURL: GetBaseUrl()})
|
||||||
apiClient = sailpoint.NewAPIClient(configuration)
|
apiClient = sailpoint.NewAPIClient(configuration)
|
||||||
if GetDebug() {
|
if GetDebug() {
|
||||||
logger := log.NewWithOptions(os.Stdout, log.Options{
|
logger := log.NewWithOptions(os.Stdout, log.Options{
|
||||||
|
ReportCaller: true,
|
||||||
ReportTimestamp: true,
|
ReportTimestamp: true,
|
||||||
Level: log.DebugLevel,
|
Level: log.DebugLevel,
|
||||||
})
|
})
|
||||||
@@ -226,11 +228,11 @@ func GetAuthToken() (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch GetAuthType() {
|
switch GetAuthType() {
|
||||||
|
|
||||||
case "pat":
|
case "pat":
|
||||||
authExpiry, err := GetPatTokenExpiry()
|
|
||||||
if err != nil {
|
authExpiry, _ := GetPatTokenExpiry()
|
||||||
return token, err
|
|
||||||
}
|
|
||||||
if authExpiry.After(time.Now()) {
|
if authExpiry.After(time.Now()) {
|
||||||
|
|
||||||
tempToken, err := GetPatToken()
|
tempToken, err := GetPatToken()
|
||||||
@@ -254,16 +256,11 @@ func GetAuthToken() (string, error) {
|
|||||||
|
|
||||||
token = tempToken
|
token = tempToken
|
||||||
}
|
}
|
||||||
|
|
||||||
case "oauth":
|
case "oauth":
|
||||||
|
|
||||||
authExpiry, err := GetOAuthTokenExpiry()
|
authExpiry, _ := GetOAuthTokenExpiry()
|
||||||
if err != nil {
|
refreshExpiry, _ := GetOAuthRefreshExpiry()
|
||||||
return token, err
|
|
||||||
}
|
|
||||||
refreshExpiry, err := GetOAuthRefreshExpiry()
|
|
||||||
if err != nil {
|
|
||||||
return token, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if authExpiry.After(time.Now()) {
|
if authExpiry.After(time.Now()) {
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func GetSearchTemplates() ([]SearchTemplate, error) {
|
|||||||
file, err := os.OpenFile(templateFile, os.O_RDWR, 0777)
|
file, err := os.OpenFile(templateFile, os.O_RDWR, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
||||||
log.Debug("error opening file %s", templateFile)
|
log.Debug("error opening file", "file", templateFile)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user