ory-am/hydra

View on GitHub

Showing 853 of 853 total issues

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

        for _, tc := range []struct{ token string }{
            {""},
            {"foo"},
            // tokens with two parts will be handled by the HMAC strategy
            {"foo.bar.baz"},
Severity: Minor
Found in fositex/token_strategy_test.go and 1 other location - About 40 mins to fix
fositex/token_strategy_test.go on lines 40..52

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 108.

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

Function makeOAuth2Request has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func makeOAuth2Request(t *testing.T, reg driver.Registry, hc *http.Client, oc *client.Client, values url.Values) (gjson.Result, *http.Response) {
Severity: Minor
Found in consent/strategy_default_test.go - About 35 mins to fix

    Function ValidateCsrfSession has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func ValidateCsrfSession(r *http.Request, conf x.CookieConfigProvider, store sessions.Store, name, expectedCSRF string, f *flow.Flow) error {
    Severity: Minor
    Found in consent/csrf.go - About 35 mins to fix

      Method DefaultStrategy.requestConsent has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          ctx context.Context,
          w http.ResponseWriter,
          r *http.Request,
          ar fosite.AuthorizeRequester,
          f *flow.Flow,
      Severity: Minor
      Found in consent/strategy_default.go - About 35 mins to fix

        Method DefaultStrategy.verifyAuthentication has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            ctx context.Context,
            w http.ResponseWriter,
            r *http.Request,
            req fosite.AuthorizeRequester,
            verifier string,
        Severity: Minor
        Found in consent/strategy_default.go - About 35 mins to fix

          Function newRegistryDefault has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func newRegistryDefault(t testing.TB, url string, c *config.DefaultProvider, migrate bool, ctxer contextx.Contextualizer) driver.Registry {
          Severity: Minor
          Found in internal/driver.go - About 35 mins to fix

            Function cleanupRun has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func cleanupRun(ctx context.Context, notAfter time.Time, limit int, batchSize int, routines ...cleanupRoutine) error {
            Severity: Minor
            Found in cmd/cli/handler_janitor.go - About 35 mins to fix

              Function testRegistry has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func testRegistry(t *testing.T, ctx context.Context, k string, t1 driver.Registry, t2 driver.Registry) {
              Severity: Minor
              Found in persistence/sql/persister_test.go - About 35 mins to fix

                Function NewOAuth2LoginRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func NewOAuth2LoginRequest(challenge string, client OAuth2Client, requestUrl string, skip bool, subject string) *OAuth2LoginRequest {
                Severity: Minor
                Found in internal/httpclient/model_o_auth2_login_request.go - About 35 mins to fix

                  Function UpdateClientTokenLifespans has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func UpdateClientTokenLifespans(t *testing.T, conf *oauth2.Config, clientID string, lifespans client.Lifespans, adminTS *httptest.Server) {
                  Severity: Minor
                  Found in internal/testhelpers/oauth2.go - About 35 mins to fix

                    Function assertCreateVerifiableCredential has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func assertCreateVerifiableCredential(t *testing.T, reg driver.Registry, nonce string, accessToken *oauth2.Token, alg jose.SignatureAlgorithm) {
                    Severity: Minor
                    Found in oauth2/oauth2_auth_code_test.go - About 35 mins to fix

                      Method MockOAuth2Provider.IntrospectToken has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func (m *MockOAuth2Provider) IntrospectToken(arg0 context.Context, arg1 string, arg2 fosite.TokenType, arg3 fosite.Session, arg4 ...string) (fosite.TokenType, fosite.AccessRequester, error) {
                      Severity: Minor
                      Found in oauth2/oauth2_provider_mock_test.go - About 35 mins to fix

                        Method Persister.createSession has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func (p *Persister) createSession(ctx context.Context, signature string, requester fosite.Requester, table tableName, expiresAt time.Time) error {
                        Severity: Minor
                        Found in persistence/sql/persister_oauth2.go - About 35 mins to fix

                          Function doTestRollback has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          func doTestRollback(m InternalRegistry, t *testing.T,
                              createFn func(context.Context, string, fosite.Requester) error,
                              getFn func(context.Context, string, fosite.Session) (fosite.Requester, error),
                              revokeFn func(context.Context, string) error,
                          Severity: Minor
                          Found in oauth2/fosite_store_helpers.go - About 35 mins to fix

                            Function TestHelperManagerKeySet has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            func TestHelperManagerKeySet(m Manager, algo string, keys *jose.JSONWebKeySet, suffix string, parallel bool) func(t *testing.T) {
                            Severity: Minor
                            Found in jwk/manager_test_helpers.go - About 35 mins to fix

                              Function createAccessTokenSession has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func createAccessTokenSession(subject, client string, token string, expiresAt time.Time, fs x.FositeStorer, scopes fosite.Arguments) {
                              Severity: Minor
                              Found in oauth2/revocator_test.go - About 35 mins to fix

                                Method Persister.sqlSchemaFromRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                func (p *Persister) sqlSchemaFromRequest(ctx context.Context, signature string, r fosite.Requester, table tableName, expiresAt time.Time) (*OAuth2RequestSQL, error) {
                                Severity: Minor
                                Found in persistence/sql/persister_oauth2.go - About 35 mins to fix

                                  Function doTestCommit has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func doTestCommit(m InternalRegistry, t *testing.T,
                                      createFn func(context.Context, string, fosite.Requester) error,
                                      getFn func(context.Context, string, fosite.Session) (fosite.Requester, error),
                                      revokeFn func(context.Context, string) error,
                                  Severity: Minor
                                  Found in oauth2/fosite_store_helpers.go - About 35 mins to fix

                                    Function executeHookAndUpdateSession has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    func executeHookAndUpdateSession(ctx context.Context, reg x.HTTPClientProvider, hookConfig *config.HookConfig, reqBodyBytes []byte, session *Session) error {
                                    Severity: Minor
                                    Found in oauth2/token_hook.go - About 35 mins to fix

                                      Method DefaultStrategy.ObfuscateSubjectIdentifier has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (s *DefaultStrategy) ObfuscateSubjectIdentifier(ctx context.Context, cl fosite.Client, subject, forcedIdentifier string) (string, error) {
                                          if c, ok := cl.(*client.Client); ok && c.SubjectType == "pairwise" {
                                              algorithm, ok := s.r.SubjectIdentifierAlgorithm(ctx)[c.SubjectType]
                                              if !ok {
                                                  return "", errorsx.WithStack(fosite.ErrInvalidRequest.WithHintf(`Subject Identifier Algorithm '%s' was requested by OAuth 2.0 Client '%s' but is not configured.`, c.SubjectType, c.GetID()))
                                      Severity: Major
                                      Found in consent/strategy_default.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language