Showing 15 of 34 total issues
Method evaluateTriggers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void evaluateTriggers(RequiredActionContext context) {
int daysToExpirePassword = context.getRealm().getPasswordPolicy()
.getDaysToExpirePassword();
if (daysToExpirePassword != -1) {
- 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 verifyMSChapV2Password
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private boolean verifyMSChapV2Password(String plaintext) {
if (msChapChallenge != null && msChap2Response != null) {
if (plaintext == null || plaintext.isEmpty()) {
LOGGER.warn("plaintext must not be empty");
- 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 isValid
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean isValid(RealmModel realm, UserModel user,
CredentialInput credentialInput) {
if (Objects.equals(credentialInput.getType(), getType())) {
CredentialModel credentialModel = getCredentialStore(user)
- 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 verifyChapPassword
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private boolean verifyChapPassword(String plaintext) {
RadiusAttribute chapPasswordA = accessRequest.getAttribute(CHAP_PASSWORD);
RadiusAttribute chapChallengeA = accessRequest.getAttribute(CHAP_CHALLENGE);
if (chapPasswordA != null) {
byte[] chapPassword = chapPasswordA.getValue();
- 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 prepareAnswer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public final RadiusPacket prepareAnswer(RadiusPacket answer) {
RadiusPacket resAnswer = answer;
IRadiusUserInfoGetter radiusUserInfoGetter = KeycloakSessionUtils
.getRadiusUserInfo(session);
- 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 init
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private boolean init(RadiusClientConnection clientConnection,
String username,
AuthProtocol protocol,
KeycloakSession threadSession,
RealmModel realm,
Method generateAuthenticatorResponse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
byte[] password,
byte[] ntResponse,
byte[] peerChallenge,
byte[] authenticatorChallenge,
byte[] userName) throws NoSuchAlgorithmException {
Method desEncrypt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static void desEncrypt(byte[] clear,
byte[] key, int keyOffset, byte[] cypher, int cypherOffset) {
Method runJobInTransaction
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static <T> T runJobInTransaction(KeycloakSessionFactory factory,
KeycloakSessionTaskWithReturn<T> task) {
KeycloakSession session = factory.create();
KeycloakTransaction tx = session.getTransactionManager();
try {
- 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 read
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public KeycloakAttributes read() {
Set<KEYCLOAK_TYPE> groups = getKeycloakTypes();
for (KEYCLOAK_TYPE type : groups) {
Map<String, Set<String>> attributes = getAttributes(type);
- 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 getPassword
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public RadiusCredentialModel getPassword(RealmModel realm, UserModel user) {
List<CredentialModel> passwords = null;
if (user instanceof CachedUserModel && !((CachedUserModel) user).isMarkedForEviction()) {
CachedUserModel cached = (CachedUserModel) user;
- 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 getServiceMap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static Map<String, List<IRadiusServiceProvider>> getServiceMap(
KeycloakSession session) {
if (serviceMap.isEmpty()) {
Set<IRadiusServiceProvider> allProviders = session
.getAllProviders(IRadiusServiceProvider.class);
- 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 fillAnswer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void fillAnswer(RadiusPacket answer) {
for (RadiusAttributeHolder<KEYCLOAK_TYPE> attributeHolder : attributeHolders) {
Map<String, Set<String>> attributes = attributeHolder.getAttributes();
for (Map.Entry<String, Set<String>> entry : attributes.entrySet()) {
- 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 handleAnswer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private RadiusPacket handleAnswer(AccessRequest request,
AuthProtocol authProtocol,
KeycloakSession threadSession,
InetSocketAddress remoteAddress) {
boolean init = authRequestInitialization.init(remoteAddress, request.getUserName(),
- 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 getSharedSecret
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public String getSharedSecret(InetSocketAddress address) {
InetAddress inetAddress = address
.getAddress();
if (inetAddress == null) {
- 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"