// NewOktaProvider creates a new instance of Okta as an identity provider.
NewOktaProvider creates a new instance of Okta as an identity provider.
// NewOktaProvider creates a new instance of Okta as an identity provider .
func NewOktaProvider(p *Provider) (*OktaProvider, error) {
	ctx := context.Background()
	if p.ProviderURL == "" {
		return nil, ErrMissingProviderURL
	}
	var err error
	p.provider, err = oidc.NewProvider(ctx, p.ProviderURL)
	if err != nil {
		return nil, err
	}
	if len(p.Scopes) == 0 {
		p.Scopes = []string{oidc.ScopeOpenID, "profile", "email", "groups", "offline_access"}
	}
	p.verifier = p.provider.Verifier(&oidc.Config{ClientID: p.ClientID})
	p.oauth = &oauth2.Config{
		ClientID:     p.ClientID,
		ClientSecret: p.ClientSecret,
		Endpoint:     p.provider.Endpoint(),
		RedirectURL:  p.RedirectURL.String(),
		Scopes:       p.Scopes,
	}
	var claims struct {
		RevokeURL string `json:"revocation_endpoint"`
	}
	if err := p.provider.Claims(&claims); err != nil {
		return nil, err
	}
	oktaProvider := OktaProvider{Provider: p}
	oktaProvider.RevokeURL, err = url.Parse(claims.RevokeURL)
	if err != nil {
		return nil, err
	}
	return &oktaProvider, nil
}
func NewOktaProvider ( p * Provider ) ( * OktaProvider , error ) { ctx := context . Background ( ) if p . ProviderURL == " " { return nil , ErrMissingProviderURL } var err error p . provider , err = oidc . NewProvider ( ctx , p . ProviderURL ) if err != nil { return nil , err } if len ( p . Scopes ) == 0 { p . Scopes = [ ] string { oidc . ScopeOpenID , " " , " " , " " , " " } } p . verifier = p . provider . Verifier ( & oidc . Config { ClientID : p . ClientID } ) p . oauth = & oauth2 . Config { ClientID : p . ClientID , ClientSecret : p . ClientSecret , Endpoint : p . provider . Endpoint ( ) , RedirectURL : p . RedirectURL . String ( ) , Scopes : p . Scopes , } var claims struct { RevokeURL string `json:"revocation_endpoint"` } if err := p . provider . Claims ( & claims ) ; err != nil { return nil , err } oktaProvider := OktaProvider { Provider : p } oktaProvider . RevokeURL , err = url . Parse ( claims . RevokeURL ) if err != nil { return nil , err } return & oktaProvider , nil }
NewOktaProvider creates a new instance of Okta as an identity provider.
NewOktaProvider creates a new instance of Okta as an identity provider .
// okta supports a revocation endpoint