Skip to content

Commit 0b3fe35

Browse files
committed
#72: PR fixes - method naming
1 parent 08328a6 commit 0b3fe35

4 files changed

Lines changed: 14 additions & 17 deletions

File tree

core/src/main/java/com/onelogin/saml2/Auth.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ public class Auth {
8181
/**
8282
* The ID of the last assertion processed
8383
*/
84-
private String assertionId;
84+
private String lastAssertionId;
8585

8686
/**
8787
* The NotOnOrAfter values of the last assertion processed
8888
*/
89-
private List<Instant> assertionNotOnOrAfter;
89+
private List<Instant> lastAssertionNotOnOrAfter;
9090

9191
/**
9292
* User attributes data.
@@ -375,8 +375,8 @@ public void processResponse(String requestId) throws Exception {
375375
attributes = samlResponse.getAttributes();
376376
sessionIndex = samlResponse.getSessionIndex();
377377
sessionExpiration = samlResponse.getSessionNotOnOrAfter();
378-
assertionId = samlResponse.getAssertionId();
379-
assertionNotOnOrAfter = samlResponse.getNotOnOrAfter();
378+
lastAssertionId = samlResponse.getAssertionId();
379+
lastAssertionNotOnOrAfter = samlResponse.getAssertionNotOnOrAfter();
380380
LOGGER.debug("processResponse success --> " + samlResponseParameter);
381381
} else {
382382
errors.add("invalid_response");
@@ -550,15 +550,15 @@ public final DateTime getSessionExpiration()
550550
/**
551551
* @return The ID of the last assertion processed
552552
*/
553-
public String getAssertionId() {
554-
return assertionId;
553+
public String getLastAssertionId() {
554+
return lastAssertionId;
555555
}
556556

557557
/**
558558
* @return The NotOnOrAfter values of the last assertion processed
559559
*/
560-
public List<Instant> getAssertionNotOnOrAfter() {
561-
return assertionNotOnOrAfter;
560+
public List<Instant> getLastAssertionNotOnOrAfter() {
561+
return lastAssertionNotOnOrAfter;
562562
}
563563

564564
/**

core/src/main/java/com/onelogin/saml2/authn/SamlResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ public String getAssertionId() throws XPathExpressionException {
626626
/**
627627
* @return a list of NotOnOrAfter values from SubjectConfirmationData nodes in this Response
628628
*/
629-
public List<Instant> getNotOnOrAfter() throws XPathExpressionException {
629+
public List<Instant> getAssertionNotOnOrAfter() throws XPathExpressionException {
630630
final NodeList notOnOrAfterNodes = queryAssertion("/saml:Subject/saml:SubjectConfirmation/saml:SubjectConfirmationData");
631631
final ArrayList<Instant> notOnOrAfters = new ArrayList<>();
632632
for (int i = 0; i < notOnOrAfterNodes.getLength(); i++) {

core/src/test/java/com/onelogin/saml2/test/AuthTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.onelogin.saml2.test;
22

33

4-
import static com.onelogin.saml2.util.Util.UNIQUE_ID_PREFIX;
54
import static org.hamcrest.CoreMatchers.is;
65
import static org.hamcrest.CoreMatchers.containsString;
76
import static org.hamcrest.CoreMatchers.not;
@@ -22,9 +21,7 @@
2221

2322
import java.io.IOException;
2423
import java.net.URISyntaxException;
25-
import java.security.cert.CertificateEncodingException;
2624
import java.util.ArrayList;
27-
import java.util.Collection;
2825
import java.util.HashMap;
2926
import java.util.List;
3027

@@ -825,8 +822,8 @@ public void testGetAssertionDetails() throws Exception {
825822
Auth auth = new Auth(settings, request, response);
826823
auth.processResponse();
827824

828-
assertThat(auth.getAssertionId(), is("pfxeac87197-11cb-ec12-c181-ae739b54debe"));
829-
assertThat(auth.getAssertionNotOnOrAfter(), contains(new Instant("2023-08-23T06:57:01Z")));
825+
assertThat(auth.getLastAssertionId(), is("pfxeac87197-11cb-ec12-c181-ae739b54debe"));
826+
assertThat(auth.getLastAssertionNotOnOrAfter(), contains(new Instant("2023-08-23T06:57:01Z")));
830827
}
831828

832829
/**

core/src/test/java/com/onelogin/saml2/test/authn/AuthnResponseTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ public void testGetAssertionDetails() throws Exception {
482482
new SettingsBuilder().fromFile("config/config.my.properties").build(),
483483
mockRequestWithSamlResponse(Util.getFileAsString("data/responses/response1.xml.base64"))
484484
);
485-
final List<Instant> notOnOrAfters = samlResponse.getNotOnOrAfter();
485+
final List<Instant> notOnOrAfters = samlResponse.getAssertionNotOnOrAfter();
486486

487487
assertEquals("pfxa46574df-b3b0-a06a-23c8-636413198772", samlResponse.getAssertionId());
488488
assertThat(notOnOrAfters, contains(new Instant("2010-11-18T22:02:37Z")));
@@ -495,7 +495,7 @@ public void testGetAssertionDetails_encrypted() throws Exception {
495495
new SettingsBuilder().fromFile("config/config.my.properties").build(),
496496
mockRequestWithSamlResponse(Util.getFileAsString("data/responses/valid_encrypted_assertion.xml.base64"))
497497
);
498-
final List<Instant> notOnOrAfters = samlResponse.getNotOnOrAfter();
498+
final List<Instant> notOnOrAfters = samlResponse.getAssertionNotOnOrAfter();
499499

500500
assertEquals("_519c2712648ee09a06d1f9a08e9e835715fea60267", samlResponse.getAssertionId());
501501
assertThat(notOnOrAfters, contains(new Instant("2055-06-07T20:17:08Z")));
@@ -512,7 +512,7 @@ public void testGetAssertionDetails_multiple() throws Exception {
512512
settings,
513513
mockRequestWithSamlResponse(loadSignMessageAndEncode("data/responses/invalids/invalid_subjectconfirmation_multiple_issues.xml"))
514514
);
515-
final List<Instant> notOnOrAfters = samlResponse.getNotOnOrAfter();
515+
final List<Instant> notOnOrAfters = samlResponse.getAssertionNotOnOrAfter();
516516

517517
assertEquals("pfx7841991c-c73f-4035-e2ee-c170c0e1d3e4", samlResponse.getAssertionId());
518518
assertThat(notOnOrAfters, contains(new Instant("2120-06-17T14:53:44Z"), new Instant("2010-06-17T14:53:44Z")));

0 commit comments

Comments
 (0)