Showing 412 of 865 total issues
OidcUserInfo
has 78 methods (exceeds 20 allowed). Consider refactoring. Open
type OidcUserInfo struct {
// End-User's birthday, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format. The year MAY be 0000, indicating that it is omitted. To represent only the year, YYYY format is allowed. Note that depending on the underlying platform's date related function, providing just year can result in varying month and day, so the implementers need to take this factor into account to correctly process the dates.
Birthdate *string `json:"birthdate,omitempty"`
// End-User's preferred e-mail address. Its value MUST conform to the RFC 5322 [RFC5322] addr-spec syntax. The RP MUST NOT rely upon this value being unique, as discussed in Section 5.7.
Email *string `json:"email,omitempty"`
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 833 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"`
RegistrySQL
has 63 methods (exceeds 20 allowed). Consider refactoring. Open
type RegistrySQL struct {
l *logrusx.Logger
al *logrusx.Logger
conf *config.DefaultProvider
ch *client.Handler
File handler.go
has 787 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)
Function testFositeJWTBearerGrantStorage
has 236 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)
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"`
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
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
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
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.
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