ory-am/hydra

View on GitHub

Showing 412 of 865 total issues

Function TestHelperNID has 52 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestHelperNID(r interface {
    client.ManagerProvider
    FlowCipher() *aead.XChaCha20Poly1305
}, t1ValidNID consent.Manager, t2InvalidNID consent.Manager) func(t *testing.T) {
    testClient := client.Client{ID: "2022-03-11-client-nid-test-1"}
Severity: Minor
Found in consent/test/manager_test_helpers.go - About 1 hr to fix

    Method Handler.rejectOAuth2ConsentRequest has 52 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (h *Handler) rejectOAuth2ConsentRequest(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
        ctx := r.Context()
    
        challenge := stringsx.Coalesce(
            r.URL.Query().Get("consent_challenge"),
    Severity: Minor
    Found in consent/handler.go - About 1 hr to fix

      Function TestGetLoginRequestWithDuplicateAccept has 52 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestGetLoginRequestWithDuplicateAccept(t *testing.T) {
          t.Run("Test get login request with duplicate accept", func(t *testing.T) {
              ctx := context.Background()
              challenge := "challenge"
              requestURL := "http://192.0.2.1"
      Severity: Minor
      Found in consent/handler_test.go - About 1 hr to fix

        Method APIClient.decode has 52 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
            if len(b) == 0 {
                return nil
            }
            if s, ok := v.(*string); ok {
        Severity: Minor
        Found in internal/httpclient/client.go - About 1 hr to fix

          Function TestGetOrGenerateKeys has 52 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func TestGetOrGenerateKeys(t *testing.T) {
              t.Parallel()
              reg := internal.NewMockedRegistry(t, &contextx.Default{})
          
              setId := uuid.NewUUID().String()
          Severity: Minor
          Found in jwk/helper_test.go - About 1 hr to fix

            Method Handler.rejectOAuth2LoginRequest has 51 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (h *Handler) rejectOAuth2LoginRequest(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                ctx := r.Context()
            
                challenge := stringsx.Coalesce(
                    r.URL.Query().Get("login_challenge"),
            Severity: Minor
            Found in consent/handler.go - About 1 hr to fix

              Function purge has 51 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func purge(cmd *cobra.Command, args []string, sl *servicelocatorx.Options, dOpts []driver.OptionsModifier) error {
                  ctx := cmd.Context()
                  var d driver.Registry
              
                  co := []configx.OptionModifier{
              Severity: Minor
              Found in cmd/cli/handler_janitor.go - About 1 hr to fix

                Method router.callback has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (rt *router) callback(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                    if len(r.URL.Query().Get("error")) > 0 {
                        _, _ = fmt.Fprintf(rt.cmd.ErrOrStderr(), "Got error: %s\n", r.URL.Query().Get("error_description"))
                
                        w.WriteHeader(http.StatusInternalServerError)
                Severity: Minor
                Found in cmd/cmd_perform_authorization_code.go - About 1 hr to fix

                  Function getRefreshRequests has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func getRefreshRequests(uniqueName string, lifespan time.Duration) []*fosite.AccessRequest {
                      var tokenSignature = "4c7c7e8b3a77ad0c3ec846a21653c48b45dbfa31" //nolint:gosec
                      return []*fosite.AccessRequest{
                          {
                              GrantTypes: []string{
                  Severity: Minor
                  Found in internal/testhelpers/janitor_test_helper.go - About 1 hr to fix

                    Function Test_toSDKFriendlyJSONWebKey has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func Test_toSDKFriendlyJSONWebKey(t *testing.T) {
                        publicJWK := []byte(`{
                            "kty": "RSA",
                            "e": "AQAB",
                            "use": "sig",
                    Severity: Minor
                    Found in cmd/cli/handler_jwk_test.go - About 1 hr to fix

                      Method Handler.acceptOAuth2LoginRequest has 10 return statements (exceeds 4 allowed).
                      Open

                      func (h *Handler) acceptOAuth2LoginRequest(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                          ctx := r.Context()
                      
                          challenge := stringsx.Coalesce(
                              r.URL.Query().Get("login_challenge"),
                      Severity: Major
                      Found in consent/handler.go - About 1 hr to fix

                        Method OidcAPIService.CreateVerifiableCredentialExecute has 10 return statements (exceeds 4 allowed).
                        Open

                        func (a *OidcAPIService) CreateVerifiableCredentialExecute(r ApiCreateVerifiableCredentialRequest) (*VerifiableCredentialResponse, *http.Response, error) {
                            var (
                                localVarHTTPMethod  = http.MethodPost
                                localVarPostBody    interface{}
                                formFiles           []formFile
                        Severity: Major
                        Found in internal/httpclient/api_oidc.go - About 1 hr to fix

                          Method DefaultStrategy.requestAuthentication has 10 return statements (exceeds 4 allowed).
                          Open

                          func (s *DefaultStrategy) requestAuthentication(ctx context.Context, w http.ResponseWriter, r *http.Request, ar fosite.AuthorizeRequester) (err error) {
                              ctx, span := trace.SpanFromContext(ctx).TracerProvider().Tracer("").Start(ctx, "DefaultStrategy.requestAuthentication")
                              defer otelx.End(span, &err)
                          
                              prompt := stringsx.Splitx(ar.GetRequestForm().Get("prompt"), " ")
                          Severity: Major
                          Found in consent/strategy_default.go - About 1 hr to fix

                            Function MockConsentRequest has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            func MockConsentRequest(key string, remember bool, rememberFor int, hasError bool, skip bool, authAt bool, loginChallengeBase string, network string) (c *flow.OAuth2ConsentRequest, h *flow.AcceptOAuth2ConsentRequest, f *flow.Flow) {
                            Severity: Major
                            Found in consent/test/manager_test_helpers.go - About 1 hr to fix

                              Function SaneMockHandleConsentRequest has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func SaneMockHandleConsentRequest(t *testing.T, m consent.Manager, f *flow.Flow, c *flow.OAuth2ConsentRequest, authAt time.Time, rememberFor int, remember bool, hasError bool) *flow.AcceptOAuth2ConsentRequest {
                              Severity: Major
                              Found in consent/test/manager_test_helpers.go - About 1 hr to fix

                                Method APIClient.prepareRequest has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    ctx context.Context,
                                    path string, method string,
                                    postBody interface{},
                                    headerParams map[string]string,
                                    queryParams url.Values,
                                Severity: Major
                                Found in internal/httpclient/client.go - About 1 hr to fix

                                  Function NewKeysImportCmd has 10 return statements (exceeds 4 allowed).
                                  Open

                                  func NewKeysImportCmd() *cobra.Command {
                                      cmd := &cobra.Command{
                                          Use:  "jwk set-id file-1 [file-2] [file-n]",
                                          Args: cobra.MinimumNArgs(1),
                                          Example: `{{ .CommandPath }} my-set ./path/to/jwk.json ./path/to/jwk-2.json --format json
                                  Severity: Major
                                  Found in cmd/cmd_import_jwk.go - About 1 hr to fix

                                    Function GetOrCreateTLSCertificate has 10 return statements (exceeds 4 allowed).
                                    Open

                                    func GetOrCreateTLSCertificate(ctx context.Context, d driver.Registry, iface config.ServeInterface, stopReload <-chan struct{}) func(*tls.ClientHelloInfo) (*tls.Certificate, error) {
                                        lock.Lock()
                                        defer lock.Unlock()
                                    
                                        // check if certificates are configured
                                    Severity: Major
                                    Found in cmd/server/helper_cert.go - About 1 hr to fix

                                      Function serve has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          ctx context.Context,
                                          d driver.Registry,
                                          cmd *cobra.Command,
                                          wg *sync.WaitGroup,
                                          iface config.ServeInterface,
                                      Severity: Major
                                      Found in cmd/server/handler.go - About 1 hr to fix

                                        Method Handler.oAuth2Authorize has 10 return statements (exceeds 4 allowed).
                                        Open

                                        func (h *Handler) oAuth2Authorize(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                                            ctx := r.Context()
                                        
                                            authorizeRequest, err := h.r.OAuth2Provider().NewAuthorizeRequest(ctx, r)
                                            if err != nil {
                                        Severity: Major
                                        Found in oauth2/handler.go - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language