Skip to content

Commit

Permalink
Update config
Browse files Browse the repository at this point in the history
  • Loading branch information
shilgapira committed Dec 19, 2023
1 parent 180f441 commit ae56b2b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion descope/api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ func TestRoutesSignInOTP(t *testing.T) {
func TestSkipVerifyValue(t *testing.T) {
require.True(t, CertificateVerifyNever.SkipVerifyValue("foo"))
require.False(t, CertificateVerifyAlways.SkipVerifyValue("foo"))
require.False(t, CertificateVerifyAutomatic.SkipVerifyValue("https://api.descope.com"))
require.False(t, CertificateVerifyAutomatic.SkipVerifyValue(defaultURL))
require.False(t, CertificateVerifyAutomatic.SkipVerifyValue(defaultURL+"/v1/auth"))
require.False(t, CertificateVerifyAutomatic.SkipVerifyValue(" http"))
require.True(t, CertificateVerifyAutomatic.SkipVerifyValue("https://localhost"))
require.True(t, CertificateVerifyAutomatic.SkipVerifyValue("https://127.0.0.1"))
Expand Down
8 changes: 7 additions & 1 deletion descope/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ func NewWithConfig(config *Config) (*DescopeClient, error) {
}
config.setManagementKey()

c := api.NewClient(api.ClientParams{BaseURL: config.DescopeBaseURL, CustomDefaultHeaders: config.CustomDefaultHeaders, DefaultClient: config.DefaultClient, ProjectID: config.ProjectID, VerifyServerCertificate: config.VerifyServerCertificate})
c := api.NewClient(api.ClientParams{
ProjectID: config.ProjectID,
BaseURL: config.DescopeBaseURL,
DefaultClient: config.DefaultClient,
CustomDefaultHeaders: config.CustomDefaultHeaders,
CertificateVerify: config.CertificateVerify,
})

authService, err := auth.NewAuth(auth.AuthParams{
ProjectID: config.ProjectID,
Expand Down
4 changes: 2 additions & 2 deletions descope/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ type Config struct {
DescopeBaseURL string
// DefaultClient (optional, http.DefaultClient) - override the default client used to Do the actual http request.
DefaultClient api.IHttpClient
// VerifyServerCertificate (optional) - verify the server certificate
VerifyServerCertificate bool
// CertificateVerifyMode (optional, CertificateVerifyAutomatic) - override the default server certificate verification behavior
CertificateVerify api.CertificateVerifyMode
// CustomDefaultHeaders (optional, nil) - add custom headers to all requests used to communicate with descope services.
CustomDefaultHeaders map[string]string
// LogLevel (optional, LogNone) - set a log level (Debug/Info/None) for the sdk to use when logging.
Expand Down

0 comments on commit ae56b2b

Please sign in to comment.