use of org.simbasecurity.core.config.SimbaConfigurationParameter.PASSWORD_RESET_TOKEN_URL in project simba-os by cegeka.
the class LinkGeneratorTest method generateResetPasswordUrl_WillGenerateLinksToResetPassword_BasedOnSimbaProperty_WithTokenAndUsername.
@Test
public void generateResetPasswordUrl_WillGenerateLinksToResetPassword_BasedOnSimbaProperty_WithTokenAndUsername() throws Exception {
List<String> links = Arrays.asList("https://www.simba.be:1000/simba", "https://www.dag.no:8080/FYFAEN");
when(configurationServiceMock.getValue(PASSWORD_RESET_TOKEN_URL)).thenReturn(links);
EmailAddress email = emailFactory.email("myEmail@myProvider.com");
String urlEscapedEmail = "myEmail%40myProvider.com";
Token token = generateToken();
List<URL> urls = linkGenerator.generateResetPasswordLinks(email, token);
String queryParams = String.format("email=%s&token=%s", urlEscapedEmail, token.asString());
assertThat(urls).extracting(URL::getHost, URL::getProtocol, URL::getPort, URL::getQuery, URL::getPath).containsExactly(tuple("www.simba.be", "https", 1000, queryParams, "/simba/http/simba-new-pwd"), tuple("www.dag.no", "https", 8080, queryParams, "/FYFAEN/http/simba-new-pwd"));
}
Aggregations