ory-am/hydra

View on GitHub

Showing 853 of 853 total issues

Method OAuth2APIService.AcceptOAuth2LoginRequestExecute has 67 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (a *OAuth2APIService) AcceptOAuth2LoginRequestExecute(r ApiAcceptOAuth2LoginRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
    var (
        localVarHTTPMethod  = http.MethodPut
        localVarPostBody    interface{}
        formFiles           []formFile
Severity: Minor
Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

    Method JwkAPIService.CreateJsonWebKeySetExecute has 67 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (a *JwkAPIService) CreateJsonWebKeySetExecute(r ApiCreateJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) {
        var (
            localVarHTTPMethod  = http.MethodPost
            localVarPostBody    interface{}
            formFiles           []formFile
    Severity: Minor
    Found in internal/httpclient/api_jwk.go - About 1 hr to fix

      Method OAuth2APIService.RejectOAuth2ConsentRequestExecute has 67 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (a *OAuth2APIService) RejectOAuth2ConsentRequestExecute(r ApiRejectOAuth2ConsentRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
          var (
              localVarHTTPMethod  = http.MethodPut
              localVarPostBody    interface{}
              formFiles           []formFile
      Severity: Minor
      Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

        Method OAuth2APIService.RejectOAuth2LoginRequestExecute has 67 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (a *OAuth2APIService) RejectOAuth2LoginRequestExecute(r ApiRejectOAuth2LoginRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
            var (
                localVarHTTPMethod  = http.MethodPut
                localVarPostBody    interface{}
                formFiles           []formFile
        Severity: Minor
        Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

          Function testRegistry has 67 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func testRegistry(t *testing.T, ctx context.Context, k string, t1 driver.Registry, t2 driver.Registry) {
              t.Run("package=client/manager="+k, func(t *testing.T) {
                  t.Run("case=create-get-update-delete", client.TestHelperCreateGetUpdateDeleteClient(k, t1.Persister().Connection(context.Background()), t1.ClientManager(), t2.ClientManager()))
          
                  t.Run("case=autogenerate-key", client.TestHelperClientAutoGenerateKey(k, t1.ClientManager()))
          Severity: Minor
          Found in persistence/sql/persister_test.go - About 1 hr to fix

            Method Handler.createVerifiableCredential has 18 return statements (exceeds 4 allowed).
            Open

            func (h *Handler) createVerifiableCredential(w http.ResponseWriter, r *http.Request) {
                ctx := r.Context()
                session := NewSessionWithCustomClaims(ctx, h.c, "")
                accessToken := fosite.AccessTokenFromRequest(r)
                tokenType, _, err := h.r.OAuth2Provider().IntrospectToken(ctx, accessToken, fosite.AccessToken, session)
            Severity: Major
            Found in oauth2/handler.go - About 1 hr to fix

              Method OAuth2APIService.AcceptOAuth2LogoutRequestExecute has 66 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (a *OAuth2APIService) AcceptOAuth2LogoutRequestExecute(r ApiAcceptOAuth2LogoutRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
                  var (
                      localVarHTTPMethod  = http.MethodPut
                      localVarPostBody    interface{}
                      formFiles           []formFile
              Severity: Minor
              Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

                Function TestValidateDynamicRegistration has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func TestValidateDynamicRegistration(t *testing.T) {
                    ctx := context.Background()
                    c := internal.NewConfigurationWithDefaults()
                    c.MustSet(ctx, config.KeySubjectTypesSupported, []string{"pairwise", "public"})
                    c.MustSet(ctx, config.KeyDefaultClientScope, []string{"openid"})
                Severity: Minor
                Found in client/validator_test.go - About 1 hr to fix

                  Method JwkAPIService.SetJsonWebKeyExecute has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (a *JwkAPIService) SetJsonWebKeyExecute(r ApiSetJsonWebKeyRequest) (*JsonWebKey, *http.Response, error) {
                      var (
                          localVarHTTPMethod  = http.MethodPut
                          localVarPostBody    interface{}
                          formFiles           []formFile
                  Severity: Minor
                  Found in internal/httpclient/api_jwk.go - About 1 hr to fix

                    Method Handler.oauth2TokenExchange has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (h *Handler) oauth2TokenExchange(w http.ResponseWriter, r *http.Request) {
                        ctx := r.Context()
                        session := NewSessionWithCustomClaims(ctx, h.c, "")
                    
                        accessRequest, err := h.r.OAuth2Provider().NewAccessRequest(ctx, r, session)
                    Severity: Minor
                    Found in oauth2/handler.go - About 1 hr to fix

                      Function TestAuthCodeWithMockStrategy has 17 return statements (exceeds 4 allowed).
                      Open

                      func TestAuthCodeWithMockStrategy(t *testing.T) {
                          ctx := context.Background()
                          for _, strat := range []struct{ d string }{{d: "opaque"}, {d: "jwt"}} {
                              t.Run("strategy="+strat.d, func(t *testing.T) {
                                  conf := internal.NewConfigurationWithDefaults()
                      Severity: Major
                      Found in oauth2/oauth2_auth_code_test.go - About 1 hr to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                withWrongClientAfterConsent := &http.Client{
                                    Jar: testhelpers.NewEmptyCookieJar(t),
                                    CheckRedirect: func(req *http.Request, _ []*http.Request) error {
                                        if req.URL.Path != "/oauth2/auth" {
                                            return nil
                        Severity: Major
                        Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                        oauth2/oauth2_auth_code_test.go on lines 522..536

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 165.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        func (j *JanitorConsentTestHelper) RefreshTokenNotAfterSetup(ctx context.Context, cl client.Manager, store x.FositeStorer) func(t *testing.T) {
                            return func(t *testing.T) {
                                // Create refresh token clients and session
                                for _, fr := range j.flushRefreshRequests {
                                    require.NoError(t, cl.CreateClient(ctx, fr.Client.(*client.Client)))
                        Severity: Major
                        Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
                        internal/testhelpers/janitor_test_helper.go on lines 94..103

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 165.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            b.Run("strategy=opaque", func(b *testing.B) {
                                initialDBSpans := dbSpans(spans)
                                for i := 0; i < b.N; i++ {
                                    run("opaque")(b)
                                }
                        Severity: Major
                        Found in oauth2/oauth2_client_credentials_bench_test.go and 1 other location - About 1 hr to fix
                        oauth2/oauth2_client_credentials_bench_test.go on lines 134..142

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 165.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                withWrongClientAfterLogin := &http.Client{
                                    Jar: testhelpers.NewEmptyCookieJar(t),
                                    CheckRedirect: func(req *http.Request, _ []*http.Request) error {
                                        if req.URL.Path != "/oauth2/auth" {
                                            return nil
                        Severity: Major
                        Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                        oauth2/oauth2_auth_code_test.go on lines 537..551

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 165.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        func (j *JanitorConsentTestHelper) AccessTokenNotAfterSetup(ctx context.Context, cl client.Manager, store x.FositeStorer) func(t *testing.T) {
                            return func(t *testing.T) {
                                // Create access token clients and session
                                for _, r := range j.flushAccessRequests {
                                    require.NoError(t, cl.CreateClient(ctx, r.Client.(*client.Client)))
                        Severity: Major
                        Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
                        internal/testhelpers/janitor_test_helper.go on lines 124..132

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 165.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            b.Run("strategy=jwt", func(b *testing.B) {
                                initialDBSpans := dbSpans(spans)
                                for i := 0; i < b.N; i++ {
                                    run("jwt")(b)
                                }
                        Severity: Major
                        Found in oauth2/oauth2_client_credentials_bench_test.go and 1 other location - About 1 hr to fix
                        oauth2/oauth2_client_credentials_bench_test.go on lines 144..152

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 165.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            t.Run("Test_Helper/Run_PEMBlockForKey_With_RSA", func(t *testing.T) {
                                RSIDKS, err := jwk.GenerateJWK(context.Background(), jose.RS256, "test-id-1", "sig")
                                require.NoError(t, err)
                                key, err := jwk.FindPrivateKey(RSIDKS)
                                require.NoError(t, err)
                        Severity: Major
                        Found in jwk/helper_test.go and 2 other locations - About 1 hr to fix
                        jwk/helper_test.go on lines 166..175
                        jwk/helper_test.go on lines 177..186

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 164.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            t.Run("Test_Helper/Run_PEMBlockForKey_With_EdDSA", func(t *testing.T) {
                                EdDSAIDKS, err := jwk.GenerateJWK(context.Background(), jose.EdDSA, "test-id-3", "sig")
                                require.NoError(t, err)
                                key, err := jwk.FindPrivateKey(EdDSAIDKS)
                                require.NoError(t, err)
                        Severity: Major
                        Found in jwk/helper_test.go and 2 other locations - About 1 hr to fix
                        jwk/helper_test.go on lines 155..164
                        jwk/helper_test.go on lines 166..175

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 164.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            t.Run("Test_Helper/Run_PEMBlockForKey_With_ECDSA", func(t *testing.T) {
                                ECDSAIDKS, err := jwk.GenerateJWK(context.Background(), jose.ES256, "test-id-2", "sig")
                                require.NoError(t, err)
                                key, err := jwk.FindPrivateKey(ECDSAIDKS)
                                require.NoError(t, err)
                        Severity: Major
                        Found in jwk/helper_test.go and 2 other locations - About 1 hr to fix
                        jwk/helper_test.go on lines 155..164
                        jwk/helper_test.go on lines 177..186

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 164.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language