use of org.springframework.security.saml2.provider.service.authentication.AbstractSaml2AuthenticationRequest in project spring-security by spring-projects.
the class Saml2LoginConfigurerTests method authenticationRequestWhenCustomAuthnRequestRepositoryThenUses.
@Test
public void authenticationRequestWhenCustomAuthnRequestRepositoryThenUses() throws Exception {
this.spring.register(CustomAuthenticationRequestRepository.class).autowire();
MockHttpServletRequestBuilder request = get("/saml2/authenticate/registration-id");
this.mvc.perform(request).andExpect(status().isFound());
Saml2AuthenticationRequestRepository<AbstractSaml2AuthenticationRequest> repository = this.spring.getContext().getBean(Saml2AuthenticationRequestRepository.class);
verify(repository).saveAuthenticationRequest(any(AbstractSaml2AuthenticationRequest.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
}
use of org.springframework.security.saml2.provider.service.authentication.AbstractSaml2AuthenticationRequest in project spring-security by spring-projects.
the class HttpSessionSaml2AuthenticationRequestRepositoryTests method loadAuthenticationRequestWhenNoAttributeInSessionThenNull.
@Test
public void loadAuthenticationRequestWhenNoAttributeInSessionThenNull() {
this.request.getSession();
AbstractSaml2AuthenticationRequest authenticationRequest = this.authenticationRequestRepository.loadAuthenticationRequest(this.request);
assertThat(authenticationRequest).isNull();
}
use of org.springframework.security.saml2.provider.service.authentication.AbstractSaml2AuthenticationRequest in project spring-security by spring-projects.
the class HttpSessionSaml2AuthenticationRequestRepositoryTests method saveAuthenticationRequestWhenNullAuthenticationRequestThenDontSave.
@Test
public void saveAuthenticationRequestWhenNullAuthenticationRequestThenDontSave() {
this.request.getSession();
this.authenticationRequestRepository.saveAuthenticationRequest(null, this.request, this.response);
AbstractSaml2AuthenticationRequest authenticationRequest = this.authenticationRequestRepository.loadAuthenticationRequest(this.request);
assertThat(authenticationRequest).isNull();
}
use of org.springframework.security.saml2.provider.service.authentication.AbstractSaml2AuthenticationRequest in project spring-security by spring-projects.
the class HttpSessionSaml2AuthenticationRequestRepositoryTests method removeAuthenticationRequestWhenValidSessionNoAttributeThenReturnsNull.
@Test
public void removeAuthenticationRequestWhenValidSessionNoAttributeThenReturnsNull() {
MockHttpSession session = mock(MockHttpSession.class);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setSession(session);
AbstractSaml2AuthenticationRequest authenticationRequest = this.authenticationRequestRepository.removeAuthenticationRequest(request, this.response);
verify(session).getAttribute(anyString());
assertThat(authenticationRequest).isNull();
}
use of org.springframework.security.saml2.provider.service.authentication.AbstractSaml2AuthenticationRequest in project spring-security by spring-projects.
the class HttpSessionSaml2AuthenticationRequestRepositoryTests method saveAuthenticationRequestWhenSessionDontExistsThenCreateAndSave.
@Test
public void saveAuthenticationRequestWhenSessionDontExistsThenCreateAndSave() {
AbstractSaml2AuthenticationRequest mockAuthenticationRequest = mock(AbstractSaml2AuthenticationRequest.class);
this.authenticationRequestRepository.saveAuthenticationRequest(mockAuthenticationRequest, this.request, this.response);
AbstractSaml2AuthenticationRequest authenticationRequest = this.authenticationRequestRepository.loadAuthenticationRequest(this.request);
assertThat(authenticationRequest).isNotNull();
}
Aggregations