Showing 403 of 850 total issues
File strategy_default.go
has 902 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package consent
DefaultProvider
has 73 methods (exceeds 20 allowed). Consider refactoring. Open
type DefaultProvider struct {
l *logrusx.Logger
p *configx.Provider
c contextx.Contextualizer
}
Function Middleware
has a Cognitive Complexity of 83 (exceeds 20 allowed). Consider refactoring. Open
func Middleware(
reg interface {
x.RegistryLogger
oauth2.Registry
client.Registry
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function TestClientCredentials
has 290 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestClientCredentials(t *testing.T) {
ctx := context.Background()
reg := internal.NewMockedRegistry(t, &contextx.Default{})
reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
public, admin := testhelpers.NewOAuth2Server(ctx, t, reg)
File manager_hsm_test.go
has 835 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
//go:build hsm
// +build hsm
File model_oidc_configuration.go
has 832 lines of code (exceeds 500 allowed). Consider refactoring. Open
/*
Ory Hydra API
Documentation for all of Ory Hydra's APIs.
JsonWebKey
has 67 methods (exceeds 20 allowed). Consider refactoring. Open
type JsonWebKey struct {
// The \"alg\" (algorithm) parameter identifies the algorithm intended for use with the key. The values used should either be registered in the IANA \"JSON Web Signature and Encryption Algorithms\" registry established by [JWA] or be a value that contains a Collision- Resistant Name.
Alg string `json:"alg"`
Crv *string `json:"crv,omitempty"`
D *string `json:"d,omitempty"`
File handler.go
has 780 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package oauth2
Function TestOAuth2AwareCORSMiddleware
has 239 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestOAuth2AwareCORSMiddleware(t *testing.T) {
ctx := context.Background()
r := internal.NewRegistryMemory(t, internal.NewConfigurationWithDefaults(), &contextx.Default{})
token, signature, _ := r.OAuth2HMACStrategy().GenerateAccessToken(ctx, nil)
Function TestUserinfo
has 239 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestUserinfo(t *testing.T) {
ctx := context.Background()
conf := internal.NewConfigurationWithDefaults()
conf.MustSet(ctx, config.KeyScopeStrategy, "")
conf.MustSet(ctx, config.KeyAuthCodeLifespan, lifespan)
IntrospectedOAuth2Token
has 58 methods (exceeds 20 allowed). Consider refactoring. Open
type IntrospectedOAuth2Token struct {
// Active is a boolean indicator of whether or not the presented token is currently active. The specifics of a token's \"active\" state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a \"true\" value return for the \"active\" property will generally indicate that a given token has been issued by this authorization server, has not been revoked by the resource owner, and is within its given time window of validity (e.g., after its issuance time and before its expiration time).
Active bool `json:"active"`
// Audience contains a list of the token's intended audiences.
Aud []string `json:"aud,omitempty"`
Function TestMigrations
has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring. Open
func TestMigrations(t *testing.T) {
connections := make(map[string]*pop.Connection, 1)
if testing.Short() {
reg := internal.NewMockedRegistry(t, &contextx.Default{})
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Validator.Validate
has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring. Open
func (v *Validator) Validate(ctx context.Context, c *Client) error {
if c.TokenEndpointAuthMethod == "" {
c.TokenEndpointAuthMethod = "client_secret_basic"
} else if c.TokenEndpointAuthMethod == "private_key_jwt" {
if len(c.JSONWebKeysURI) == 0 && c.JSONWebKeys == nil {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
OAuth2ApiService
has 56 methods (exceeds 20 allowed). Consider refactoring. Open
type OAuth2ApiService service
File grant_jwtbearer.js
has 500 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
import {
createClient,
Method APIClient.prepareRequest
has a Cognitive Complexity of 66 (exceeds 20 allowed). Consider refactoring. Open
func (c *APIClient) prepareRequest(
ctx context.Context,
path string, method string,
postBody interface{},
headerParams map[string]string,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function testFositeJWTBearerGrantStorage
has 217 lines of code (exceeds 50 allowed). Consider refactoring. Open
func testFositeJWTBearerGrantStorage(x InternalRegistry) func(t *testing.T) {
return func(t *testing.T) {
grantManager := x.GrantManager()
keyManager := x.KeyManager()
grantStorage := x.OAuth2Storage().(rfc7523.RFC7523KeyStorage)
OAuth2ConsentRequest
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
type OAuth2ConsentRequest struct {
// ACR represents the Authentication AuthorizationContext Class Reference value for this authentication session. You can use it to express that, for example, a user authenticated using two factor authentication.
Acr *string `json:"acr,omitempty"`
Amr []string `json:"amr,omitempty"`
// ID is the identifier (\"authorization challenge\") of the consent authorization request. It is used to identify the session.
RegistryBase
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
type RegistryBase struct {
l *logrusx.Logger
al *logrusx.Logger
conf *config.DefaultProvider
ch *client.Handler
File janitor_test_helper.go
has 734 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package testhelpers