Skip to content

Commit

Permalink
Use non-deprecated Kibana SAML callback URL in tests (elastic#98882)
Browse files Browse the repository at this point in the history
/api/security/saml/callback is the correct URL,
while /api/security/v1/saml is the deprecated URL.

See also: elastic/kibana#81733

Fixes: elastic#99985

---------

Co-authored-by: Craig Rodrigues <[email protected]>
Signed-off-by: Athena Brown <[email protected]>
  • Loading branch information
rodrigc authored Oct 12, 2023
1 parent 9792e8b commit c1c8d1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions docs/changelog/98882.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 99983
summary: Use non-deprecated SAML callback URL in tests
area: Authorization
type: enhancement
issues:
- 99985
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ public class TransportSamlInitiateSingleSignOnActionTests extends IdpSamlTestCas
public void testGetResponseForRegisteredSp() throws Exception {
final SamlInitiateSingleSignOnRequest request = new SamlInitiateSingleSignOnRequest();
request.setSpEntityId("https://sp.some.org");
request.setAssertionConsumerService("https://sp.some.org/api/security/v1/saml");
request.setAssertionConsumerService("https://sp.some.org/api/security/saml/callback");
final PlainActionFuture<SamlInitiateSingleSignOnResponse> future = new PlainActionFuture<>();
final TransportSamlInitiateSingleSignOnAction action = setupTransportAction(true);
action.doExecute(mock(Task.class), request, future);

final SamlInitiateSingleSignOnResponse response = future.get();
assertThat(response.getEntityId(), equalTo("https://sp.some.org"));
assertThat(response.getPostUrl(), equalTo("https://sp.some.org/api/security/v1/saml"));
assertThat(response.getPostUrl(), equalTo("https://sp.some.org/api/security/saml/callback"));
assertThat(response.getSamlResponse(), containsString(TRANSIENT));
assertContainsAttributeWithValue(response.getSamlResponse(), "email", "[email protected]");
assertContainsAttributeWithValue(response.getSamlResponse(), "name", "Saml Enduser");
Expand All @@ -77,7 +77,7 @@ public void testGetResponseForRegisteredSp() throws Exception {
public void testGetResponseWithoutSecondaryAuthenticationInIdpInitiated() throws Exception {
final SamlInitiateSingleSignOnRequest request = new SamlInitiateSingleSignOnRequest();
request.setSpEntityId("https://sp.some.org");
request.setAssertionConsumerService("https://sp.some.org/api/security/v1/saml");
request.setAssertionConsumerService("https://sp.some.org/api/security/saml/callback");
final PlainActionFuture<SamlInitiateSingleSignOnResponse> future = new PlainActionFuture<>();
final TransportSamlInitiateSingleSignOnAction action = setupTransportAction(false);
action.doExecute(mock(Task.class), request, future);
Expand All @@ -89,7 +89,7 @@ public void testGetResponseWithoutSecondaryAuthenticationInIdpInitiated() throws
public void testGetResponseForNotRegisteredSpInIdpInitiated() throws Exception {
final SamlInitiateSingleSignOnRequest request = new SamlInitiateSingleSignOnRequest();
request.setSpEntityId("https://sp2.other.org");
request.setAssertionConsumerService("https://sp2.some.org/api/security/v1/saml");
request.setAssertionConsumerService("https://sp2.some.org/api/security/saml/callback");
final PlainActionFuture<SamlInitiateSingleSignOnResponse> future = new PlainActionFuture<>();
final TransportSamlInitiateSingleSignOnAction action = setupTransportAction(true);
action.doExecute(mock(Task.class), request, future);
Expand Down Expand Up @@ -179,7 +179,7 @@ private TransportSamlInitiateSingleSignOnAction setupTransportAction(boolean wit
"https://sp.some.org",
"test sp",
true,
new URL("https://sp.some.org/api/security/v1/saml"),
new URL("https://sp.some.org/api/security/saml/callback"),
TRANSIENT,
Duration.ofMinutes(5),
null,
Expand Down

0 comments on commit c1c8d1e

Please sign in to comment.