Showing 391 of 391 total issues

Method extract has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public Optional<Credentials> extract(final CallContext ctx) {
        val webContext = ctx.webContext();

        var username = Optional.<String>empty();

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

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

    @Override
    public boolean renewSession(final WebContext context) {
        Map<String, Object> attributes = new HashMap<>();
        val request = ((JEEContext) context).getNativeRequest();
        val session = request.getSession(false);
pac4j-jakartaee/src/main/java/org/pac4j/jee/context/session/JEESessionStore.java on lines 154..170

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

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

Method build has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public Config build(final Object... parameters) {

        final List<Client> clients = new ArrayList<>();
        final Map<String, Authenticator> authenticators = new HashMap<>();

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

        @Override
        public boolean renewSession(final WebContext context) {
            Map<String, Object> attributes = new HashMap<>();
            val request = ((JEEContext) context).getNativeRequest();
            val session = request.getSession(false);
    pac4j-javaee/src/main/java/org/pac4j/jee/context/session/JEESessionStore.java on lines 157..173

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

    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

    Method buildProfile has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected void buildProfile(final SAML2AuthenticationCredentials credentials) {
            UserProfile profile = (SAML2Profile) getProfileDefinition().newProfile();
    
            val nameId = credentials.getNameId();
            profile.setId(nameId.getValue());

      StravaProfile has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class StravaProfile extends OAuth20Profile {
      
          @Serial
          private static final long serialVersionUID = 995023712830997358L;
      
      

        BaseClient has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

        @Getter
        @Setter
        @ToString(exclude = "logger")
        @Accessors(chain = true)
        public abstract class BaseClient extends InitializableObject implements Client {
        Severity: Minor
        Found in pac4j-core/src/main/java/org/pac4j/core/client/BaseClient.java - About 2 hrs to fix

          Method tryCreatePasswordEncoder has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void tryCreatePasswordEncoder(final Map<String, org.pac4j.core.credentials.password.PasswordEncoder> encoders) {
                  for (var i = 0; i <= MAX_NUM_ENCODERS; i++) {
                      val type = getProperty(SPRING_ENCODER_TYPE, i);
                      if (isNotBlank(type)) {
                          final PasswordEncoder encoder;

            Method retrieveMatchers has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                protected List<Matcher> retrieveMatchers(final String matcherName, final Map<String, Matcher> matchersMap) {
                    final List<Matcher> results = new ArrayList<>();
                    for (val entry : matchersMap.entrySet()) {
                        if (areEqualsIgnoreCaseAndTrim(entry.getKey(), matcherName)) {
                            results.add(entry.getValue());

            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 convert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public Object convert(final Object attribute) {
                    if (attribute != null) {
                        if (clazz.isAssignableFrom(attribute.getClass())) {
                            return attribute;

            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

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

            package org.pac4j.oauth.client;
            
            import lombok.Getter;
            import lombok.Setter;
            import lombok.ToString;
            pac4j-oauth/src/main/java/org/pac4j/oauth/client/OAuth10Client.java on lines 1..78

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

            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

            package org.pac4j.oauth.client;
            
            import lombok.Getter;
            import lombok.Setter;
            import lombok.ToString;
            pac4j-oauth/src/main/java/org/pac4j/oauth/client/OAuth20Client.java on lines 1..78

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

            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

            Method validate has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public Optional<Credentials> validate(final CallContext ctx, final Credentials credentials) {
                    init();
            
                    val certificate = ((X509Credentials) credentials).getCertificate();

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

                  @Override
                  public void set(final WebContext context, final String key, final Object value) {
                      val prefixedKey = computePrefixedKey(key);
                      if (value == null) {
                          val httpSession = getNativeSession(context, false);
              pac4j-jakartaee/src/main/java/org/pac4j/jee/context/session/JEESessionStore.java on lines 93..111

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

              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

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

                  @Override
                  public void set(final WebContext context, final String key, final Object value) {
                      val prefixedKey = computePrefixedKey(key);
                      if (value == null) {
                          val httpSession = getNativeSession(context, false);
              pac4j-javaee/src/main/java/org/pac4j/jee/context/session/JEESessionStore.java on lines 96..114

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

              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

              Method computeClientAuthentication has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected ClientAuthentication computeClientAuthentication() {
                      val _clientID = new ClientID(configuration.getClientId());
              
                      if (configuration.getSecret() != null) {
                          // check authentication methods

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

                    @Override
                    public Collection<Cookie> getRequestCookies() {
                        final Collection<Cookie> pac4jCookies = new LinkedHashSet<>();
                        val cookies = this.request.getCookies();
                
                
                pac4j-jakartaee/src/main/java/org/pac4j/jee/context/JEEContext.java on lines 180..197

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

                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

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

                    @Override
                    public Collection<Cookie> getRequestCookies() {
                        final Collection<Cookie> pac4jCookies = new LinkedHashSet<>();
                        val cookies = this.request.getCookies();
                
                
                pac4j-javaee/src/main/java/org/pac4j/jee/context/JEEContext.java on lines 183..200

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

                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

                Method perform has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public Object perform(final Config config, final String inputDefaultUrl, final Boolean inputRenewSession,
                                          final String defaultClient, final FrameworkParameters parameters) {
                
                        LOGGER.debug("=== CALLBACK ===");

                  Method destroySession has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public void destroySession(final CallContext ctx, final String key) {
                          val webContext = ctx.webContext();
                          val sessionStore = ctx.sessionStore();
                  
                  
                    Severity
                    Category
                    Status
                    Source
                    Language