func (c *oneloginClient) SamlAssertion() (*credentials.SamlAssertion, error) {
	return c.SamlAssertionWithContext(context.Background())
}
SamlAssertion calls SamlAssertionWithContext using a background context.
package external
import (
	"bytes"
	"context"
	"encoding/base64"
	"encoding/json"
	"errors"
	"fmt"
	"github.com/mmmorris1975/aws-runas/credentials"
	"github.com/mmmorris1975/aws-runas/identity"
	"io"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"time"
)
const oneloginIdentityProvider = "OneloginIdentityProvider"
type oneloginClient struct {
	*baseClient
	apiBaseUrl string
	apiToken   *oneloginApiToken
	subdomain  string
}
func NewOneloginClient(url string) (*oneloginClient, error) {
	bc, err := newBaseClient(url)
	if err != nil {
		return nil, err
	}
	oc := new(oneloginClient)
	oc.baseClient = bc
	oc.subdomain = strings.Split(bc.authUrl.Host, `.`)[0]
	oc.setApiBaseUrl()
	if err := oc.apiAccessToken(); err != nil {
		return nil, err
	}
	oc.authUrl.RawQuery = ""
	return oc, nil
}
func (c *oneloginClient) Authenticate() error {
	return c.AuthenticateWithContext(context.Background())
}
func (c *oneloginClient) AuthenticateWithContext(ctx context.Context) error {
	if err := c.gatherCredentials(); err != nil {
		return err
	}
	return c.auth(ctx)
}
func (c *oneloginClient) Identity() (*identity.Identity, error) {
	return c.identity(oneloginIdentityProvider), nil
}
func (c *oneloginClient) Roles(...string) (*identity.Roles, error) {
	if c.saml == nil || len(*c.saml) < 1 {
		var err error
		c.saml, err = c.SamlAssertion()
		if err != nil {
			return nil, err
		}
	}
	return c.roles()
}
func (c *oneloginClient) IdentityToken() (*credentials.OidcIdentityToken, error) {
	return c.IdentityTokenWithContext(context.Background())
}
func (c *oneloginClient) IdentityTokenWithContext(ctx context.Context) (*credentials.OidcIdentityToken, error) {
	pkce, err := newPkceCode()
	if err != nil {
		return nil, err
	}
	authzQS := c.pkceAuthzRequest(pkce.Challenge())
	vals, err := c.oauthAuthorize(fmt.Sprintf("%s/auth", c.authUrl.String()), authzQS, true)
	if err != nil {
		if err = c.AuthenticateWithContext(ctx); err != nil {
			return nil, err
		}
		return c.IdentityTokenWithContext(ctx)
	}
	if vals.Get("state") != authzQS.Get("state") {
		return nil, errOauthStateMismatch
	}
	token, err := c.oauthToken(fmt.Sprintf("%s/token", c.authUrl.String()), vals.Get("code"), pkce.Verifier())
	if err != nil {
		return nil, err
	}
	return token.IdToken, nil
}