Skip to content

Commit

Permalink
initial commit to use okta sessions API, remember session locally + r…
Browse files Browse the repository at this point in the history
…emember MFA
  • Loading branch information
hiruna committed Jun 6, 2021
1 parent beaaece commit 9a92d0f
Show file tree
Hide file tree
Showing 3 changed files with 331 additions and 34 deletions.
8 changes: 8 additions & 0 deletions helper/credentials/saml.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ func LookupCredentials(loginDetails *creds.LoginDetails, provider string) error
loginDetails.Username = username
loginDetails.Password = password

// If the provider is Okta, check for existing Okta Session Cookie (sid)
if provider == "Okta" {
_, oktaSessionCookie, err := CurrentHelper.Get(loginDetails.URL + "/sessionCookie")
if err == nil {
loginDetails.OktaSessionCookie = oktaSessionCookie
}
}

if provider == "OneLogin" {
id, secret, err := CurrentHelper.Get(path.Join(loginDetails.URL, "/auth/oauth2/v2/token"))
if err != nil {
Expand Down
17 changes: 9 additions & 8 deletions pkg/creds/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package creds

// LoginDetails used to authenticate
type LoginDetails struct {
ClientID string // used by OneLogin
ClientSecret string // used by OneLogin
Username string
Password string
MFAToken string
DuoMFAOption string
URL string
StateToken string // used by Okta
ClientID string // used by OneLogin
ClientSecret string // used by OneLogin
Username string
Password string
MFAToken string
DuoMFAOption string
URL string
StateToken string // used by Okta
OktaSessionCookie string // used by Okta
}
Loading

0 comments on commit 9a92d0f

Please sign in to comment.