Skip to content

Commit 100496f

Browse files
sgramponeanaiberta
authored andcommitted
Quality fix
(cherry picked from commit 3526a9b)
1 parent 0a0f664 commit 100496f

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

gamsaml/src/main/java/com/genexus/saml/SamlHelper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public AuthnRequest createStockAuthnRequest() {
6363

6464
boolean removeAuthContext = false;
6565
String configuredAuthContext = GamSamlProperties.getAuthnContext();
66-
if (configuredAuthContext.compareTo("NONE") == 0)
66+
if (configuredAuthContext.equals("NONE"))
6767
removeAuthContext = true;
6868
else {
69-
if (configuredAuthContext.compareTo("SMARTCARD_AUTHN_CTX") == 0) {
69+
if (configuredAuthContext.equals("SMARTCARD_AUTHN_CTX")) {
7070
ref.setAuthnContextClassRef(AuthnContext.SMARTCARD_PKI_AUTHN_CTX);
7171
logger.debug("[createStockAuthnRequest] AuthnContext.SMARTCARD_PKI_AUTHN_CTX");
72-
} else if (configuredAuthContext.compareTo("PPT_AUTHN_CTX") == 0) {
72+
} else if (configuredAuthContext.equals("PPT_AUTHN_CTX")) {
7373
ref.setAuthnContextClassRef(AuthnContext.PPT_AUTHN_CTX);
7474
logger.debug("[createStockAuthnRequest] AuthnContext.PPT_AUTHN_CTX");
7575
} else if (configuredAuthContext.startsWith("urn:oasis:names:tc:SAML:2.0")) {
@@ -123,7 +123,7 @@ public void doAuthenticationRedirect(final HttpServletResponse response) throws
123123

124124

125125
String isRedirectBinding = GamSamlProperties.isRedirectBinding();
126-
if (isRedirectBinding.compareTo("true") == 0) {
126+
if (isRedirectBinding.equals("true")) {
127127
samlEndpoint.setBinding(SAMLConstants.SAML2_REDIRECT_BINDING_URI);
128128
logger.debug("[doAuthenticationRedirect] SAMLConstants.SAML2_REDIRECT_BINDING_URI");
129129
} else {

gamsaml/src/main/java/com/genexus/saml/SamlReceiver.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,24 +212,14 @@ public boolean validateDetachedSignature(String signature, String document, Stri
212212

213213

214214
private String getAlgorithmCode(String algorithm) {
215-
logger.debug("[getAlgorithmCode] algorithm: " + algorithm);
216-
String code;
217215
if (algorithm.contains("rsa")) {
218216
if (algorithm.contains("sha1"))
219-
code = "SHA1withRSA";
217+
return "SHA1withRSA";
220218
else if (algorithm.contains("sha256"))
221-
code = "SHA256withRSA";
222-
else {
223-
logger.debug("[getAlgorithmCode] code not matched: " + algorithm);
224-
code = algorithm;
225-
}
226-
227-
} else {
228-
logger.debug("[getAlgorithmCode] code not matched: " + algorithm);
229-
code = algorithm;
219+
return "SHA256withRSA";
230220
}
231-
logger.debug("[getAlgorithmCode] returned code: " + code);
232-
return code;
221+
logger.error("[getAlgorithmCode] code not matched: " + algorithm);
222+
return algorithm;
233223
}
234224

235225

0 commit comments

Comments
 (0)