Skip to content

Commit

Permalink
[SDK-4015] Add Factor Management endpoints (#176)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergiu Ghitea <[email protected]>
  • Loading branch information
ewanharris and sergiught authored Mar 13, 2023
1 parent a9c16db commit a0b6f13
Show file tree
Hide file tree
Showing 10 changed files with 1,047 additions and 25 deletions.
6 changes: 1 addition & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,14 @@ linters-settings:
capital: true
goimports:
local-prefixes: "github.com/auth0/go-auth0"
revive:
rules:
- name: package-comments
severity: warning
disabled: true

issues:
exclude-use-default: false
exclude:
- "Error return value of `response.Body.Close` is not checked"
- "Error return value of `w.Write` is not checked"
- "G307: Deferring unsafe method \"Close\" on type \"io.ReadCloser\""
- "should have a package comment"
exclude-rules:
- path: "(.+)_test.go"
linters:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $(GO_BIN)/govulncheck:

lint: $(GO_BIN)/golangci-lint ## Run linting on the go files
@echo "==> Running linting on the library with golangci-lint..."
@golangci-lint run -v --fix -c .golangci.yaml ./...
@golangci-lint run -v --fix -c .golangci.yml ./...

check-vuln: $(GO_BIN)/govulncheck ## Check for vulnerabilities
@echo "==> Checking for vulnerabilities..."
Expand Down
9 changes: 4 additions & 5 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package client

import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"log"
"net/http"
Expand All @@ -15,9 +17,6 @@ import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/clientcredentials"

"encoding/base64"
"encoding/json"

"github.com/auth0/go-auth0"
)

Expand Down Expand Up @@ -104,12 +103,12 @@ func Auth0ClientInfoTransport(base http.RoundTripper, auth0ClientInfo *Auth0Clie
base = http.DefaultTransport
}

auth0ClientJson, err := json.Marshal(auth0ClientInfo)
auth0ClientJSON, err := json.Marshal(auth0ClientInfo)
if err != nil {
return nil, err
}

auth0ClientEncoded := base64.StdEncoding.EncodeToString(auth0ClientJson)
auth0ClientEncoded := base64.StdEncoding.EncodeToString(auth0ClientJSON)

return RoundTripFunc(func(req *http.Request) (*http.Response, error) {
req.Header.Set("Auth0-Client", auth0ClientEncoded)
Expand Down
8 changes: 4 additions & 4 deletions management/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,11 +950,11 @@ type ConnectionOptionsADFS struct {
// ConnectionOptionsPingFederate is used to configure a Ping Federate Connection.
type ConnectionOptionsPingFederate struct {
// SigningCert should be used when creating or updating the public key for the Ping Federate server, it will not be
// present when reading a connection and instead you should use the Cert field to check the value.
// present when reading a connection, and instead you should use the Cert field to check the value.
SigningCert *string `json:"signingCert,omitempty"`

// Cert should only be used when reading the connection. It should not be set on creation or update of a connection, instead
// SigningCert should be used to update the public key for the Ping Federate server.
// Cert should only be used when reading the connection. It should not be set on creation or update of a connection,
// instead SigningCert should be used to update the public key for the Ping Federate server.
Cert *string `json:"cert,omitempty"`

LogoURL *string `json:"icon_url,omitempty"`
Expand All @@ -965,7 +965,7 @@ type ConnectionOptionsPingFederate struct {
DigestAlgorithm *string `json:"digestAlgorithm,omitempty"`
SignSAMLRequest *bool `json:"signSAMLRequest,omitempty"`
SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty"`
PingFederateBaseUrl *string `json:"pingFederateBaseUrl,omitempty"`
PingFederateBaseURL *string `json:"pingFederateBaseUrl,omitempty"`
NonPersistentAttrs *[]string `json:"non_persistent_attrs,omitempty"`
UpstreamParams map[string]interface{} `json:"upstream_params,omitempty"`
SetUserAttributes *string `json:"set_user_root_attributes,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion management/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ ZsUkLw2I7zI/dNlWdB8Xp7v+3w9sX5N3J/WuJ1KOO5m26kRlHQo7EzT3974g
Strategy: auth0.String("pingfederate"),
},
options: &ConnectionOptionsPingFederate{
PingFederateBaseUrl: auth0.String("https://ping.example.com"),
PingFederateBaseURL: auth0.String("https://ping.example.com"),
SigningCert: auth0.String(`-----BEGIN CERTIFICATE-----
MIID6TCCA1ICAQEwDQYJKoZIhvcNAQEFBQAwgYsxCzAJBgNVBAYTAlVTMRMwEQYD
VQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRQwEgYDVQQK
Expand Down
167 changes: 163 additions & 4 deletions management/management.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a0b6f13

Please sign in to comment.