Skip to content

Commit 8876430

Browse files
author
Luis Miranda
committed
issue #52: use LinkedHashMap for deterministic order of query params
1 parent 2c6b79c commit 8876430

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.ArrayList;
99
import java.util.Collection;
1010
import java.util.HashMap;
11+
import java.util.LinkedHashMap;
1112
import java.util.List;
1213
import java.util.Map;
1314

@@ -440,7 +441,7 @@ public void processSLO(Boolean keepLocalSession, String requestId) throws Except
440441
logoutResponseBuilder.build(inResponseTo);
441442
String samlLogoutResponse = logoutResponseBuilder.getEncodedLogoutResponse();
442443

443-
Map<String, String> parameters = new HashMap<String, String>();
444+
Map<String, String> parameters = new LinkedHashMap<String, String>();
444445

445446
parameters.put("SAMLResponse", samlLogoutResponse);
446447

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,32 +46,32 @@
4646

4747
/*
4848
* Known issues while testing
49-
*
49+
*
5050
* ECLEmma coverage plugin incompatible with PowerMock
5151
* http://stackoverflow.com/questions/23363212/powermock-eclemma-coverage-issue
5252
*
5353
* import org.junit.runner.RunWith;
54-
* import org.powermock.modules.junit4.PowerMockRunner;
54+
* import org.powermock.modules.junit4.PowerMockRunner;
5555
* @RunWith(PowerMockRunner.class)
56-
*
56+
*
5757
*/
5858
@PrepareForTest({Auth.class})
5959
public class AuthTest {
6060

6161
/*
62-
* When using @PrepareForTest and PowerMockito the breakpoints when debugging
62+
* When using @PrepareForTest and PowerMockito the breakpoints when debugging
6363
* does not work. Define Rules!
6464
* (http://stackoverflow.com/questions/35140575/powermockito-junit-and-eclemma-debugging-dosent-work)
65-
*
65+
*
6666
* https://github.com/jayway/powermock/wiki/PowerMockRule
67-
*
67+
*
6868
* import org.junit.Rule;
6969
* import org.powermock.modules.junit4.rule.PowerMockRule;
7070
* @Rule
7171
* public PowerMockRule rule = new PowerMockRule();
72-
*
72+
*
7373
*/
74-
74+
7575
//import org.powermock.modules.junit4.rule.PowerMockRule;
7676
//@Rule
7777
//public PowerMockRule rule = new PowerMockRule();
@@ -527,7 +527,7 @@ public void testProcessSLORequestSignRes() throws Exception {
527527
assertFalse(auth.isAuthenticated());
528528
assertTrue(auth.getErrors().isEmpty());
529529
auth.processSLO();
530-
verify(response).sendRedirect(matches("http:\\/\\/idp.example.com\\/simplesaml\\/saml2\\/idp\\/SingleLogoutService.php\\?SAMLResponse=(.)*&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha512&RelayState=http%3A%2F%2Flocalhost%3A8080%2Fexpected.jsp&Signature=(.)*"));
530+
verify(response).sendRedirect(matches("http:\\/\\/idp.example.com\\/simplesaml\\/saml2\\/idp\\/SingleLogoutService.php\\?SAMLResponse=(.)*&RelayState=http%3A%2F%2Flocalhost%3A8080%2Fexpected.jsp&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha512&Signature=(.)*"));
531531
verify(session, times(1)).invalidate();
532532
assertTrue(auth.getErrors().isEmpty());
533533
}

0 commit comments

Comments
 (0)