diff --git a/EXAMPLES.md b/EXAMPLES.md index 1ccbf8a0..84e1d3df 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -200,13 +200,13 @@ To handle nullable fields, create a custom struct without the omitempty tag and ```go // Define a custom struct similar to the `Tenant` struct exposed by the SDK but without the `omitempty` tag. type CustomTenant struct { -AcrValuesSupported *[]string `json:"acr_values_supported"` +ACRValuesSupported *[]string `json:"acr_values_supported"` MTLS *management.MTLSConfiguration `json:"mtls"` } // Create a custom request to set the nullable fields to null. nullableTenantSettings := &CustomTenant{ -AcrValuesSupported: nil, +ACRValuesSupported: nil, MTLS: nil, } diff --git a/management/client.go b/management/client.go index d0131443..ac3f9ed6 100644 --- a/management/client.go +++ b/management/client.go @@ -120,7 +120,7 @@ type Client struct { OIDCLogout *OIDCLogout `json:"oidc_logout,omitempty"` // SignedRequestObject JWT-secured Authorization Requests (JAR) settings for the client. - SignedRequestObject *SignedRequestObject `json:"signed_request_object,omitempty"` + SignedRequestObject *ClientSignedRequestObject `json:"signed_request_object,omitempty"` // ComplianceLevel Defines the compliance level for this client, which may restrict it's capabilities // @@ -140,8 +140,8 @@ type Client struct { RequireProofOfPossession *bool `json:"require_proof_of_possession,omitempty"` } -// SignedRequestObject is used to configure JWT-secured Authorization Requests (JAR) settings for our Client. -type SignedRequestObject struct { +// ClientSignedRequestObject is used to configure JWT-secured Authorization Requests (JAR) settings for our Client. +type ClientSignedRequestObject struct { // Indicates whether the JAR requests are mandatory Required *bool `json:"required,omitempty"` diff --git a/management/client_test.go b/management/client_test.go index f7d073ae..bd01f47f 100644 --- a/management/client_test.go +++ b/management/client_test.go @@ -36,7 +36,7 @@ func TestClientSignedRequestObject(t *testing.T) { expectedClient := &Client{ Name: auth0.Stringf("Test Client (%s)", time.Now().Format(time.StampMilli)), Description: auth0.String("This is just a test client."), - SignedRequestObject: &SignedRequestObject{ + SignedRequestObject: &ClientSignedRequestObject{ Required: auth0.Bool(true), Credentials: &[]Credential{ { diff --git a/management/management.gen.go b/management/management.gen.go index 82df73ba..80710146 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -673,19 +673,6 @@ func (a *AuthenticationMethods) String() string { return Stringify(a) } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (a *AuthorizationDetails) GetType() string { - if a == nil || a.Type == nil { - return "" - } - return *a.Type -} - -// String returns a string representation of AuthorizationDetails. -func (a *AuthorizationDetails) String() string { - return Stringify(a) -} - // GetLifetimeInSeconds returns the LifetimeInSeconds field if it's non-nil, zero value otherwise. func (a *AWSClientAddon) GetLifetimeInSeconds() int { if a == nil || a.LifetimeInSeconds == nil { @@ -1509,7 +1496,7 @@ func (c *Client) GetRequirePushedAuthorizationRequests() bool { } // GetSignedRequestObject returns the SignedRequestObject field. -func (c *Client) GetSignedRequestObject() *SignedRequestObject { +func (c *Client) GetSignedRequestObject() *ClientSignedRequestObject { if c == nil { return nil } @@ -2077,6 +2064,27 @@ func (c *ClientRefreshToken) String() string { return Stringify(c) } +// GetCredentials returns the Credentials field if it's non-nil, zero value otherwise. +func (c *ClientSignedRequestObject) GetCredentials() []Credential { + if c == nil || c.Credentials == nil { + return nil + } + return *c.Credentials +} + +// GetRequired returns the Required field if it's non-nil, zero value otherwise. +func (c *ClientSignedRequestObject) GetRequired() bool { + if c == nil || c.Required == nil { + return false + } + return *c.Required +} + +// String returns a string representation of ClientSignedRequestObject. +func (c *ClientSignedRequestObject) String() string { + return Stringify(c) +} + // String returns a string representation of CloudBeesClientAddon. func (c *CloudBeesClientAddon) String() string { return Stringify(c) @@ -6669,43 +6677,6 @@ func (e *EmailTemplate) String() string { return Stringify(e) } -// GetAlg returns the Alg field if it's non-nil, zero value otherwise. -func (e *EncryptionKey) GetAlg() string { - if e == nil || e.Alg == nil { - return "" - } - return *e.Alg -} - -// GetKid returns the Kid field if it's non-nil, zero value otherwise. -func (e *EncryptionKey) GetKid() string { - if e == nil || e.Kid == nil { - return "" - } - return *e.Kid -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (e *EncryptionKey) GetName() string { - if e == nil || e.Name == nil { - return "" - } - return *e.Name -} - -// GetPem returns the Pem field if it's non-nil, zero value otherwise. -func (e *EncryptionKey) GetPem() string { - if e == nil || e.Pem == nil { - return "" - } - return *e.Pem -} - -// String returns a string representation of EncryptionKey. -func (e *EncryptionKey) String() string { - return Stringify(e) -} - // GetEnrolledAt returns the EnrolledAt field if it's non-nil, zero value otherwise. func (e *Enrollment) GetEnrolledAt() time.Time { if e == nil || e.EnrolledAt == nil { @@ -7650,19 +7621,6 @@ func (m *MSCRMClientAddon) String() string { return Stringify(m) } -// GetEnableEndpointAliases returns the EnableEndpointAliases field if it's non-nil, zero value otherwise. -func (m *MTLSConfiguration) GetEnableEndpointAliases() bool { - if m == nil || m.EnableEndpointAliases == nil { - return false - } - return *m.EnableEndpointAliases -} - -// String returns a string representation of MTLSConfiguration. -func (m *MTLSConfiguration) String() string { - return Stringify(m) -} - // GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. func (m *MultiFactor) GetEnabled() bool { if m == nil || m.Enabled == nil { @@ -8591,27 +8549,6 @@ func (p *PromptPartials) String() string { return Stringify(p) } -// GetMechanism returns the Mechanism field if it's non-nil, zero value otherwise. -func (p *ProofOfPossession) GetMechanism() string { - if p == nil || p.Mechanism == nil { - return "" - } - return *p.Mechanism -} - -// GetRequired returns the Required field if it's non-nil, zero value otherwise. -func (p *ProofOfPossession) GetRequired() bool { - if p == nil || p.Required == nil { - return false - } - return *p.Required -} - -// String returns a string representation of ProofOfPossession. -func (p *ProofOfPossession) String() string { - return Stringify(p) -} - // GetClientID returns the ClientID field if it's non-nil, zero value otherwise. func (r *RefreshToken) GetClientID() string { if r == nil || r.ClientID == nil { @@ -8716,7 +8653,7 @@ func (r *ResourceServer) GetAllowOfflineAccess() bool { } // GetAuthorizationDetails returns the AuthorizationDetails field if it's non-nil, zero value otherwise. -func (r *ResourceServer) GetAuthorizationDetails() []AuthorizationDetails { +func (r *ResourceServer) GetAuthorizationDetails() []ResourceServerAuthorizationDetails { if r == nil || r.AuthorizationDetails == nil { return nil } @@ -8772,7 +8709,7 @@ func (r *ResourceServer) GetOptions() map[string]string { } // GetProofOfPossession returns the ProofOfPossession field. -func (r *ResourceServer) GetProofOfPossession() *ProofOfPossession { +func (r *ResourceServer) GetProofOfPossession() *ResourceServerProofOfPossession { if r == nil { return nil } @@ -8820,7 +8757,7 @@ func (r *ResourceServer) GetTokenDialect() string { } // GetTokenEncryption returns the TokenEncryption field. -func (r *ResourceServer) GetTokenEncryption() *TokenEncryption { +func (r *ResourceServer) GetTokenEncryption() *ResourceServerTokenEncryption { if r == nil { return nil } @@ -8856,11 +8793,45 @@ func (r *ResourceServer) String() string { return Stringify(r) } +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *ResourceServerAuthorizationDetails) GetType() string { + if r == nil || r.Type == nil { + return "" + } + return *r.Type +} + +// String returns a string representation of ResourceServerAuthorizationDetails. +func (r *ResourceServerAuthorizationDetails) String() string { + return Stringify(r) +} + // String returns a string representation of ResourceServerList. func (r *ResourceServerList) String() string { return Stringify(r) } +// GetMechanism returns the Mechanism field if it's non-nil, zero value otherwise. +func (r *ResourceServerProofOfPossession) GetMechanism() string { + if r == nil || r.Mechanism == nil { + return "" + } + return *r.Mechanism +} + +// GetRequired returns the Required field if it's non-nil, zero value otherwise. +func (r *ResourceServerProofOfPossession) GetRequired() bool { + if r == nil || r.Required == nil { + return false + } + return *r.Required +} + +// String returns a string representation of ResourceServerProofOfPossession. +func (r *ResourceServerProofOfPossession) String() string { + return Stringify(r) +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (r *ResourceServerScope) GetDescription() string { if r == nil || r.Description == nil { @@ -8882,6 +8853,64 @@ func (r *ResourceServerScope) String() string { return Stringify(r) } +// GetEncryptionKey returns the EncryptionKey field. +func (r *ResourceServerTokenEncryption) GetEncryptionKey() *ResourceServerTokenEncryptionKey { + if r == nil { + return nil + } + return r.EncryptionKey +} + +// GetFormat returns the Format field if it's non-nil, zero value otherwise. +func (r *ResourceServerTokenEncryption) GetFormat() string { + if r == nil || r.Format == nil { + return "" + } + return *r.Format +} + +// String returns a string representation of ResourceServerTokenEncryption. +func (r *ResourceServerTokenEncryption) String() string { + return Stringify(r) +} + +// GetAlg returns the Alg field if it's non-nil, zero value otherwise. +func (r *ResourceServerTokenEncryptionKey) GetAlg() string { + if r == nil || r.Alg == nil { + return "" + } + return *r.Alg +} + +// GetKid returns the Kid field if it's non-nil, zero value otherwise. +func (r *ResourceServerTokenEncryptionKey) GetKid() string { + if r == nil || r.Kid == nil { + return "" + } + return *r.Kid +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *ResourceServerTokenEncryptionKey) GetName() string { + if r == nil || r.Name == nil { + return "" + } + return *r.Name +} + +// GetPem returns the Pem field if it's non-nil, zero value otherwise. +func (r *ResourceServerTokenEncryptionKey) GetPem() string { + if r == nil || r.Pem == nil { + return "" + } + return *r.Pem +} + +// String returns a string representation of ResourceServerTokenEncryptionKey. +func (r *ResourceServerTokenEncryptionKey) String() string { + return Stringify(r) +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (r *RMSClientAddon) GetURL() string { if r == nil || r.URL == nil { @@ -9540,27 +9569,6 @@ func (s *SharePointClientAddon) String() string { return Stringify(s) } -// GetCredentials returns the Credentials field if it's non-nil, zero value otherwise. -func (s *SignedRequestObject) GetCredentials() []Credential { - if s == nil || s.Credentials == nil { - return nil - } - return *s.Credentials -} - -// GetRequired returns the Required field if it's non-nil, zero value otherwise. -func (s *SignedRequestObject) GetRequired() bool { - if s == nil || s.Required == nil { - return false - } - return *s.Required -} - -// String returns a string representation of SignedRequestObject. -func (s *SignedRequestObject) String() string { - return Stringify(s) -} - // GetCert returns the Cert field if it's non-nil, zero value otherwise. func (s *SigningKey) GetCert() string { if s == nil || s.Cert == nil { @@ -9767,12 +9775,12 @@ func (s *SuspiciousIPThrottling) String() string { return Stringify(s) } -// GetAcrValuesSupported returns the AcrValuesSupported field if it's non-nil, zero value otherwise. -func (t *Tenant) GetAcrValuesSupported() []string { - if t == nil || t.AcrValuesSupported == nil { +// GetACRValuesSupported returns the ACRValuesSupported field if it's non-nil, zero value otherwise. +func (t *Tenant) GetACRValuesSupported() []string { + if t == nil || t.ACRValuesSupported == nil { return nil } - return *t.AcrValuesSupported + return *t.ACRValuesSupported } // GetAllowedLogoutURLs returns the AllowedLogoutURLs field if it's non-nil, zero value otherwise. @@ -9888,7 +9896,7 @@ func (t *Tenant) GetIdleSessionLifetime() float64 { } // GetMTLS returns the MTLS field. -func (t *Tenant) GetMTLS() *MTLSConfiguration { +func (t *Tenant) GetMTLS() *TenantMTLSConfiguration { if t == nil { return nil } @@ -10301,6 +10309,19 @@ func (t *TenantGuardianMFAPage) String() string { return Stringify(t) } +// GetEnableEndpointAliases returns the EnableEndpointAliases field if it's non-nil, zero value otherwise. +func (t *TenantMTLSConfiguration) GetEnableEndpointAliases() bool { + if t == nil || t.EnableEndpointAliases == nil { + return false + } + return *t.EnableEndpointAliases +} + +// String returns a string representation of TenantMTLSConfiguration. +func (t *TenantMTLSConfiguration) String() string { + return Stringify(t) +} + // GetMode returns the Mode field if it's non-nil, zero value otherwise. func (t *TenantSessionCookie) GetMode() string { if t == nil || t.Mode == nil { @@ -10467,27 +10488,6 @@ func (t *TLSClientAuth) String() string { return Stringify(t) } -// GetEncryptionKey returns the EncryptionKey field. -func (t *TokenEncryption) GetEncryptionKey() *EncryptionKey { - if t == nil { - return nil - } - return t.EncryptionKey -} - -// GetFormat returns the Format field if it's non-nil, zero value otherwise. -func (t *TokenEncryption) GetFormat() string { - if t == nil || t.Format == nil { - return "" - } - return *t.Format -} - -// String returns a string representation of TokenEncryption. -func (t *TokenEncryption) String() string { - return Stringify(t) -} - // GetAppMetadata returns the AppMetadata field if it's non-nil, zero value otherwise. func (u *User) GetAppMetadata() map[string]interface{} { if u == nil || u.AppMetadata == nil { diff --git a/management/management.gen_test.go b/management/management.gen_test.go index 4194dff3..d7bfb33c 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -855,24 +855,6 @@ func TestAuthenticationMethods_String(t *testing.T) { } } -func TestAuthorizationDetails_GetType(tt *testing.T) { - var zeroValue string - a := &AuthorizationDetails{Type: &zeroValue} - a.GetType() - a = &AuthorizationDetails{} - a.GetType() - a = nil - a.GetType() -} - -func TestAuthorizationDetails_String(t *testing.T) { - var rawJSON json.RawMessage - v := &AuthorizationDetails{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - func TestAWSClientAddon_GetLifetimeInSeconds(tt *testing.T) { var zeroValue int a := &AWSClientAddon{LifetimeInSeconds: &zeroValue} @@ -2523,6 +2505,34 @@ func TestClientRefreshToken_String(t *testing.T) { } } +func TestClientSignedRequestObject_GetCredentials(tt *testing.T) { + var zeroValue []Credential + c := &ClientSignedRequestObject{Credentials: &zeroValue} + c.GetCredentials() + c = &ClientSignedRequestObject{} + c.GetCredentials() + c = nil + c.GetCredentials() +} + +func TestClientSignedRequestObject_GetRequired(tt *testing.T) { + var zeroValue bool + c := &ClientSignedRequestObject{Required: &zeroValue} + c.GetRequired() + c = &ClientSignedRequestObject{} + c.GetRequired() + c = nil + c.GetRequired() +} + +func TestClientSignedRequestObject_String(t *testing.T) { + var rawJSON json.RawMessage + v := &ClientSignedRequestObject{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestCloudBeesClientAddon_String(t *testing.T) { var rawJSON json.RawMessage v := &CloudBeesClientAddon{} @@ -8276,54 +8286,6 @@ func TestEmailTemplate_String(t *testing.T) { } } -func TestEncryptionKey_GetAlg(tt *testing.T) { - var zeroValue string - e := &EncryptionKey{Alg: &zeroValue} - e.GetAlg() - e = &EncryptionKey{} - e.GetAlg() - e = nil - e.GetAlg() -} - -func TestEncryptionKey_GetKid(tt *testing.T) { - var zeroValue string - e := &EncryptionKey{Kid: &zeroValue} - e.GetKid() - e = &EncryptionKey{} - e.GetKid() - e = nil - e.GetKid() -} - -func TestEncryptionKey_GetName(tt *testing.T) { - var zeroValue string - e := &EncryptionKey{Name: &zeroValue} - e.GetName() - e = &EncryptionKey{} - e.GetName() - e = nil - e.GetName() -} - -func TestEncryptionKey_GetPem(tt *testing.T) { - var zeroValue string - e := &EncryptionKey{Pem: &zeroValue} - e.GetPem() - e = &EncryptionKey{} - e.GetPem() - e = nil - e.GetPem() -} - -func TestEncryptionKey_String(t *testing.T) { - var rawJSON json.RawMessage - v := &EncryptionKey{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - func TestEnrollment_GetEnrolledAt(tt *testing.T) { var zeroValue time.Time e := &Enrollment{EnrolledAt: &zeroValue} @@ -9540,24 +9502,6 @@ func TestMSCRMClientAddon_String(t *testing.T) { } } -func TestMTLSConfiguration_GetEnableEndpointAliases(tt *testing.T) { - var zeroValue bool - m := &MTLSConfiguration{EnableEndpointAliases: &zeroValue} - m.GetEnableEndpointAliases() - m = &MTLSConfiguration{} - m.GetEnableEndpointAliases() - m = nil - m.GetEnableEndpointAliases() -} - -func TestMTLSConfiguration_String(t *testing.T) { - var rawJSON json.RawMessage - v := &MTLSConfiguration{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - func TestMultiFactor_GetEnabled(tt *testing.T) { var zeroValue bool m := &MultiFactor{Enabled: &zeroValue} @@ -10773,34 +10717,6 @@ func TestPromptPartials_String(t *testing.T) { } } -func TestProofOfPossession_GetMechanism(tt *testing.T) { - var zeroValue string - p := &ProofOfPossession{Mechanism: &zeroValue} - p.GetMechanism() - p = &ProofOfPossession{} - p.GetMechanism() - p = nil - p.GetMechanism() -} - -func TestProofOfPossession_GetRequired(tt *testing.T) { - var zeroValue bool - p := &ProofOfPossession{Required: &zeroValue} - p.GetRequired() - p = &ProofOfPossession{} - p.GetRequired() - p = nil - p.GetRequired() -} - -func TestProofOfPossession_String(t *testing.T) { - var rawJSON json.RawMessage - v := &ProofOfPossession{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - func TestRefreshToken_GetClientID(tt *testing.T) { var zeroValue string r := &RefreshToken{ClientID: &zeroValue} @@ -10936,7 +10852,7 @@ func TestResourceServer_GetAllowOfflineAccess(tt *testing.T) { } func TestResourceServer_GetAuthorizationDetails(tt *testing.T) { - var zeroValue []AuthorizationDetails + var zeroValue []ResourceServerAuthorizationDetails r := &ResourceServer{AuthorizationDetails: &zeroValue} r.GetAuthorizationDetails() r = &ResourceServer{} @@ -11107,6 +11023,24 @@ func TestResourceServer_String(t *testing.T) { } } +func TestResourceServerAuthorizationDetails_GetType(tt *testing.T) { + var zeroValue string + r := &ResourceServerAuthorizationDetails{Type: &zeroValue} + r.GetType() + r = &ResourceServerAuthorizationDetails{} + r.GetType() + r = nil + r.GetType() +} + +func TestResourceServerAuthorizationDetails_String(t *testing.T) { + var rawJSON json.RawMessage + v := &ResourceServerAuthorizationDetails{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestResourceServerList_String(t *testing.T) { var rawJSON json.RawMessage v := &ResourceServerList{} @@ -11115,6 +11049,34 @@ func TestResourceServerList_String(t *testing.T) { } } +func TestResourceServerProofOfPossession_GetMechanism(tt *testing.T) { + var zeroValue string + r := &ResourceServerProofOfPossession{Mechanism: &zeroValue} + r.GetMechanism() + r = &ResourceServerProofOfPossession{} + r.GetMechanism() + r = nil + r.GetMechanism() +} + +func TestResourceServerProofOfPossession_GetRequired(tt *testing.T) { + var zeroValue bool + r := &ResourceServerProofOfPossession{Required: &zeroValue} + r.GetRequired() + r = &ResourceServerProofOfPossession{} + r.GetRequired() + r = nil + r.GetRequired() +} + +func TestResourceServerProofOfPossession_String(t *testing.T) { + var rawJSON json.RawMessage + v := &ResourceServerProofOfPossession{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestResourceServerScope_GetDescription(tt *testing.T) { var zeroValue string r := &ResourceServerScope{Description: &zeroValue} @@ -11143,6 +11105,79 @@ func TestResourceServerScope_String(t *testing.T) { } } +func TestResourceServerTokenEncryption_GetEncryptionKey(tt *testing.T) { + r := &ResourceServerTokenEncryption{} + r.GetEncryptionKey() + r = nil + r.GetEncryptionKey() +} + +func TestResourceServerTokenEncryption_GetFormat(tt *testing.T) { + var zeroValue string + r := &ResourceServerTokenEncryption{Format: &zeroValue} + r.GetFormat() + r = &ResourceServerTokenEncryption{} + r.GetFormat() + r = nil + r.GetFormat() +} + +func TestResourceServerTokenEncryption_String(t *testing.T) { + var rawJSON json.RawMessage + v := &ResourceServerTokenEncryption{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestResourceServerTokenEncryptionKey_GetAlg(tt *testing.T) { + var zeroValue string + r := &ResourceServerTokenEncryptionKey{Alg: &zeroValue} + r.GetAlg() + r = &ResourceServerTokenEncryptionKey{} + r.GetAlg() + r = nil + r.GetAlg() +} + +func TestResourceServerTokenEncryptionKey_GetKid(tt *testing.T) { + var zeroValue string + r := &ResourceServerTokenEncryptionKey{Kid: &zeroValue} + r.GetKid() + r = &ResourceServerTokenEncryptionKey{} + r.GetKid() + r = nil + r.GetKid() +} + +func TestResourceServerTokenEncryptionKey_GetName(tt *testing.T) { + var zeroValue string + r := &ResourceServerTokenEncryptionKey{Name: &zeroValue} + r.GetName() + r = &ResourceServerTokenEncryptionKey{} + r.GetName() + r = nil + r.GetName() +} + +func TestResourceServerTokenEncryptionKey_GetPem(tt *testing.T) { + var zeroValue string + r := &ResourceServerTokenEncryptionKey{Pem: &zeroValue} + r.GetPem() + r = &ResourceServerTokenEncryptionKey{} + r.GetPem() + r = nil + r.GetPem() +} + +func TestResourceServerTokenEncryptionKey_String(t *testing.T) { + var rawJSON json.RawMessage + v := &ResourceServerTokenEncryptionKey{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestRMSClientAddon_GetURL(tt *testing.T) { var zeroValue string r := &RMSClientAddon{URL: &zeroValue} @@ -11994,34 +12029,6 @@ func TestSharePointClientAddon_String(t *testing.T) { } } -func TestSignedRequestObject_GetCredentials(tt *testing.T) { - var zeroValue []Credential - s := &SignedRequestObject{Credentials: &zeroValue} - s.GetCredentials() - s = &SignedRequestObject{} - s.GetCredentials() - s = nil - s.GetCredentials() -} - -func TestSignedRequestObject_GetRequired(tt *testing.T) { - var zeroValue bool - s := &SignedRequestObject{Required: &zeroValue} - s.GetRequired() - s = &SignedRequestObject{} - s.GetRequired() - s = nil - s.GetRequired() -} - -func TestSignedRequestObject_String(t *testing.T) { - var rawJSON json.RawMessage - v := &SignedRequestObject{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - func TestSigningKey_GetCert(tt *testing.T) { var zeroValue string s := &SigningKey{Cert: &zeroValue} @@ -12281,14 +12288,14 @@ func TestSuspiciousIPThrottling_String(t *testing.T) { } } -func TestTenant_GetAcrValuesSupported(tt *testing.T) { +func TestTenant_GetACRValuesSupported(tt *testing.T) { var zeroValue []string - t := &Tenant{AcrValuesSupported: &zeroValue} - t.GetAcrValuesSupported() + t := &Tenant{ACRValuesSupported: &zeroValue} + t.GetACRValuesSupported() t = &Tenant{} - t.GetAcrValuesSupported() + t.GetACRValuesSupported() t = nil - t.GetAcrValuesSupported() + t.GetACRValuesSupported() } func TestTenant_GetAllowedLogoutURLs(tt *testing.T) { @@ -12932,6 +12939,24 @@ func TestTenantGuardianMFAPage_String(t *testing.T) { } } +func TestTenantMTLSConfiguration_GetEnableEndpointAliases(tt *testing.T) { + var zeroValue bool + t := &TenantMTLSConfiguration{EnableEndpointAliases: &zeroValue} + t.GetEnableEndpointAliases() + t = &TenantMTLSConfiguration{} + t.GetEnableEndpointAliases() + t = nil + t.GetEnableEndpointAliases() +} + +func TestTenantMTLSConfiguration_String(t *testing.T) { + var rawJSON json.RawMessage + v := &TenantMTLSConfiguration{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestTenantSessionCookie_GetMode(tt *testing.T) { var zeroValue string t := &TenantSessionCookie{Mode: &zeroValue} @@ -13144,31 +13169,6 @@ func TestTLSClientAuth_String(t *testing.T) { } } -func TestTokenEncryption_GetEncryptionKey(tt *testing.T) { - t := &TokenEncryption{} - t.GetEncryptionKey() - t = nil - t.GetEncryptionKey() -} - -func TestTokenEncryption_GetFormat(tt *testing.T) { - var zeroValue string - t := &TokenEncryption{Format: &zeroValue} - t.GetFormat() - t = &TokenEncryption{} - t.GetFormat() - t = nil - t.GetFormat() -} - -func TestTokenEncryption_String(t *testing.T) { - var rawJSON json.RawMessage - v := &TokenEncryption{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - func TestUser_GetAppMetadata(tt *testing.T) { var zeroValue map[string]interface{} u := &User{AppMetadata: &zeroValue} diff --git a/management/resource_server.go b/management/resource_server.go index 82916e96..e7cb65fe 100644 --- a/management/resource_server.go +++ b/management/resource_server.go @@ -90,14 +90,14 @@ type ResourceServer struct { // // For more details on making custom requests, refer to the Auth0 Go SDK examples: // https://github.com/auth0/go-auth0/blob/main/EXAMPLES.md#providing-a-custom-user-struct - AuthorizationDetails *[]AuthorizationDetails `json:"authorization_details,omitempty"` + AuthorizationDetails *[]ResourceServerAuthorizationDetails `json:"authorization_details,omitempty"` // TokenEncryption specifies the token encryption for the resource server. // // Available options: // - "compact-nested-jwe" // - null - TokenEncryption *TokenEncryption `json:"token_encryption,omitempty"` + TokenEncryption *ResourceServerTokenEncryption `json:"token_encryption,omitempty"` // Proof-of-Possession configuration for access tokens. // @@ -111,17 +111,17 @@ type ResourceServer struct { // // For more details on making custom requests, refer to the Auth0 Go SDK examples: // https://github.com/auth0/go-auth0/blob/main/EXAMPLES.md#providing-a-custom-user-struct - ProofOfPossession *ProofOfPossession `json:"proof_of_possession,omitempty"` + ProofOfPossession *ResourceServerProofOfPossession `json:"proof_of_possession,omitempty"` } -// AuthorizationDetails specifies the authorization details for the resource server. -type AuthorizationDetails struct { +// ResourceServerAuthorizationDetails specifies the authorization details for the resource server. +type ResourceServerAuthorizationDetails struct { // The authorization_detail type identifier. Type *string `json:"type,omitempty"` } -// ProofOfPossession specifies the proof-of-possession configuration for access tokens. -type ProofOfPossession struct { +// ResourceServerProofOfPossession specifies the proof-of-possession configuration for access tokens. +type ResourceServerProofOfPossession struct { // Intended mechanism for Proof-of-Possession. // // Available options: @@ -132,17 +132,17 @@ type ProofOfPossession struct { Required *bool `json:"required,omitempty"` } -// TokenEncryption specifies the token encryption for the resource server. -type TokenEncryption struct { +// ResourceServerTokenEncryption specifies the token encryption for the resource server. +type ResourceServerTokenEncryption struct { // Format of the encrypted JWT payload. Format *string `json:"format,omitempty"` // EncryptionKey specifies the encryption key for the token encryption. - EncryptionKey *EncryptionKey `json:"encryption_key,omitempty"` + EncryptionKey *ResourceServerTokenEncryptionKey `json:"encryption_key,omitempty"` } -// EncryptionKey specifies the encryption key for the token encryption. -type EncryptionKey struct { +// ResourceServerTokenEncryptionKey specifies the encryption key for the token encryption. +type ResourceServerTokenEncryptionKey struct { // Name of the encryption key. Name *string `json:"name,omitempty"` diff --git a/management/resource_server_test.go b/management/resource_server_test.go index d79c027c..ead6075d 100644 --- a/management/resource_server_test.go +++ b/management/resource_server_test.go @@ -30,7 +30,7 @@ func TestResourceServer_Create(t *testing.T) { EnforcePolicies: auth0.Bool(true), TokenDialect: auth0.String("rfc9068_profile_authz"), ConsentPolicy: auth0.String("transactional-authorization-with-mfa"), - AuthorizationDetails: &[]AuthorizationDetails{ + AuthorizationDetails: &[]ResourceServerAuthorizationDetails{ { Type: auth0.String("payment"), }, @@ -38,9 +38,9 @@ func TestResourceServer_Create(t *testing.T) { Type: auth0.String("my custom type"), }, }, - TokenEncryption: &TokenEncryption{ + TokenEncryption: &ResourceServerTokenEncryption{ Format: auth0.String("compact-nested-jwe"), - EncryptionKey: &EncryptionKey{ + EncryptionKey: &ResourceServerTokenEncryptionKey{ Name: auth0.String("my JWE public key"), Alg: auth0.String("RSA-OAEP-256"), Kid: auth0.String("my-key-id"), @@ -60,7 +60,7 @@ aibASY5pIRiKENmbZELDtucCAwEAAQ== -----END PUBLIC KEY-----`), }, }, - ProofOfPossession: &ProofOfPossession{ + ProofOfPossession: &ResourceServerProofOfPossession{ Mechanism: auth0.String("mtls"), Required: auth0.Bool(true), }, diff --git a/management/tenant.go b/management/tenant.go index 04419be6..924943a7 100644 --- a/management/tenant.go +++ b/management/tenant.go @@ -88,7 +88,7 @@ type Tenant struct { // If `true`, flexible factors will be enabled for MFA in the PostLogin action. CustomizeMFAInPostLoginAction *bool `json:"customize_mfa_in_postlogin_action,omitempty"` - // AcrValuesSupported Supported ACR values + // ACRValuesSupported Supported ACR values // // To unset values (set to null), use a PATCH request like this: // @@ -99,7 +99,7 @@ type Tenant struct { // // For more details on making custom requests, refer to the Auth0 Go SDK examples: // https://github.com/auth0/go-auth0/blob/main/EXAMPLES.md#providing-a-custom-user-struct - AcrValuesSupported *[]string `json:"acr_values_supported,omitempty"` + ACRValuesSupported *[]string `json:"acr_values_supported,omitempty"` // MTLS configuration for the tenant. Default is false. // @@ -112,14 +112,14 @@ type Tenant struct { // // For more details on making custom requests, refer to the Auth0 Go SDK examples: // https://github.com/auth0/go-auth0/blob/main/EXAMPLES.md#providing-a-custom-user-struct - MTLS *MTLSConfiguration `json:"mtls,omitempty"` + MTLS *TenantMTLSConfiguration `json:"mtls,omitempty"` // Enables the use of Pushed Authorization Requests PushedAuthorizationRequestsSupported *bool `json:"pushed_authorization_requests_supported,omitempty"` } -// MTLSConfiguration hold settings for mTLS. If true, enables mTLS endpoint aliases. -type MTLSConfiguration struct { +// TenantMTLSConfiguration hold settings for mTLS. If true, enables mTLS endpoint aliases. +type TenantMTLSConfiguration struct { // If true, enables mTLS endpoint aliases EnableEndpointAliases *bool `json:"enable_endpoint_aliases,omitempty"` } diff --git a/management/tenant_test.go b/management/tenant_test.go index 56034a45..dd82a39d 100644 --- a/management/tenant_test.go +++ b/management/tenant_test.go @@ -42,9 +42,9 @@ func TestTenantManager(t *testing.T) { Sessions: &TenantSessions{ OIDCLogoutPromptEnabled: auth0.Bool(false), }, - AcrValuesSupported: &[]string{"foo", "bar"}, + ACRValuesSupported: &[]string{"foo", "bar"}, PushedAuthorizationRequestsSupported: auth0.Bool(true), - MTLS: &MTLSConfiguration{ + MTLS: &TenantMTLSConfiguration{ EnableEndpointAliases: auth0.Bool(true), }, } @@ -64,14 +64,14 @@ func TestTenantManager(t *testing.T) { assert.Equal(t, newTenantSettings.GetEnabledLocales(), actualTenantSettings.GetEnabledLocales()) assert.Equal(t, newTenantSettings.GetSandboxVersion(), actualTenantSettings.GetSandboxVersion()) assert.Equal(t, newTenantSettings.GetSessions().GetOIDCLogoutPromptEnabled(), actualTenantSettings.GetSessions().GetOIDCLogoutPromptEnabled()) - assert.Equal(t, newTenantSettings.GetAcrValuesSupported(), actualTenantSettings.GetAcrValuesSupported()) + assert.Equal(t, newTenantSettings.GetACRValuesSupported(), actualTenantSettings.GetACRValuesSupported()) assert.Equal(t, newTenantSettings.GetPushedAuthorizationRequestsSupported(), actualTenantSettings.GetPushedAuthorizationRequestsSupported()) assert.Equal(t, newTenantSettings.GetMTLS().GetEnableEndpointAliases(), actualTenantSettings.GetMTLS().GetEnableEndpointAliases()) - // If AcrValuesSupported and MTLS is not Passed Should not change the values. + // If ACRValuesSupported and MTLS is not Passed Should not change the values. updatedNewTenant := &Tenant{ MTLS: nil, - AcrValuesSupported: nil, + ACRValuesSupported: nil, FriendlyName: auth0.String("My Example Tenant"), } err = api.Tenant.Update(context.Background(), updatedNewTenant) @@ -90,7 +90,7 @@ func TestTenantManager(t *testing.T) { assert.Equal(t, newActualTenantSettings.GetEnabledLocales(), actualTenantSettings.GetEnabledLocales()) assert.Equal(t, newActualTenantSettings.GetSandboxVersion(), actualTenantSettings.GetSandboxVersion()) assert.Equal(t, newActualTenantSettings.GetSessions().GetOIDCLogoutPromptEnabled(), actualTenantSettings.GetSessions().GetOIDCLogoutPromptEnabled()) - assert.Equal(t, newActualTenantSettings.GetAcrValuesSupported(), actualTenantSettings.GetAcrValuesSupported()) + assert.Equal(t, newActualTenantSettings.GetACRValuesSupported(), actualTenantSettings.GetACRValuesSupported()) assert.Equal(t, newActualTenantSettings.GetPushedAuthorizationRequestsSupported(), actualTenantSettings.GetPushedAuthorizationRequestsSupported()) assert.Equal(t, newActualTenantSettings.GetMTLS().GetEnableEndpointAliases(), actualTenantSettings.GetMTLS().GetEnableEndpointAliases()) } @@ -109,8 +109,8 @@ func TestTenantManager_NullableFields(t *testing.T) { require.NoError(t, err) }) newTenantSettings := &Tenant{ - AcrValuesSupported: &[]string{"foo", "bar"}, - MTLS: &MTLSConfiguration{ + ACRValuesSupported: &[]string{"foo", "bar"}, + MTLS: &TenantMTLSConfiguration{ EnableEndpointAliases: auth0.Bool(true), }, } @@ -118,33 +118,33 @@ func TestTenantManager_NullableFields(t *testing.T) { assert.NoError(t, err) actualTenantSettings, err := api.Tenant.Read(context.Background()) assert.NoError(t, err) - assert.Equal(t, newTenantSettings.GetAcrValuesSupported(), actualTenantSettings.GetAcrValuesSupported()) + assert.Equal(t, newTenantSettings.GetACRValuesSupported(), actualTenantSettings.GetACRValuesSupported()) assert.Equal(t, newTenantSettings.GetMTLS().GetEnableEndpointAliases(), actualTenantSettings.GetMTLS().GetEnableEndpointAliases()) - // Set empty array values for AcrValuesSupported - emptyAcrValuesSupported := &Tenant{ - AcrValuesSupported: &[]string{}, + // Set empty array values for ACRValuesSupported + emptyACRValuesSupported := &Tenant{ + ACRValuesSupported: &[]string{}, } - err = api.Tenant.Update(context.Background(), emptyAcrValuesSupported) + err = api.Tenant.Update(context.Background(), emptyACRValuesSupported) assert.NoError(t, err) actualTenantSettings, err = api.Tenant.Read(context.Background()) assert.NoError(t, err) - assert.Equal(t, emptyAcrValuesSupported.GetAcrValuesSupported(), actualTenantSettings.GetAcrValuesSupported()) + assert.Equal(t, emptyACRValuesSupported.GetACRValuesSupported(), actualTenantSettings.GetACRValuesSupported()) // Set null values create a new Tenant Struct without omitting the fields type CustomTenant struct { - AcrValuesSupported *[]string `json:"acr_values_supported"` - MTLS *MTLSConfiguration `json:"mtls"` + ACRValuesSupported *[]string `json:"acr_values_supported"` + MTLS *TenantMTLSConfiguration `json:"mtls"` } nullableTenantSettings := &CustomTenant{ - AcrValuesSupported: nil, + ACRValuesSupported: nil, MTLS: nil, } err = api.Request(context.Background(), http.MethodPatch, api.URI("tenants", "settings"), nullableTenantSettings) assert.NoError(t, err) actualTenantSettings, err = api.Tenant.Read(context.Background()) assert.NoError(t, err) - assert.Nil(t, actualTenantSettings.GetAcrValuesSupported()) + assert.Nil(t, actualTenantSettings.GetACRValuesSupported()) assert.Nil(t, actualTenantSettings.GetMTLS()) }