@Test public void getIssuer_hasIssuer() { IssuerServiceResponse response = service.getIssuer(request); assertThat(response.getIssuer(), equalTo(iss)); assertThat(response.getLoginHint(), equalTo(login_hint)); assertThat(response.getTargetLinkUri(), equalTo(target_link_uri)); assertThat(response.getRedirectUrl(), nullValue()); }
@Override public IssuerServiceResponse getIssuer(HttpServletRequest request) { String iss = request.getParameter("iss"); if (!Strings.isNullOrEmpty(iss)) { if (!whitelist.isEmpty() && !whitelist.contains(iss)) { throw new AuthenticationServiceException("Whitelist was nonempty, issuer was not in whitelist: " + iss); } if (blacklist.contains(iss)) { throw new AuthenticationServiceException("Issuer was in blacklist: " + iss); } return new IssuerServiceResponse(iss, request.getParameter("login_hint"), request.getParameter("target_link_uri")); } else { try { String redirectUri = request.getRequestURL().toString(); URIBuilder builder = new URIBuilder(accountChooserUrl); builder.addParameter("redirect_uri", redirectUri); return new IssuerServiceResponse(builder.build().toString()); } catch (URISyntaxException e) { throw new AuthenticationServiceException("Account Chooser URL is not valid", e); } } }
ThirdPartyIssuerService implements IssuerService { @Override public IssuerServiceResponse getIssuer(HttpServletRequest request) { String iss = request.getParameter("iss"); if (!Strings.isNullOrEmpty(iss)) { if (!whitelist.isEmpty() && !whitelist.contains(iss)) { throw new AuthenticationServiceException("Whitelist was nonempty, issuer was not in whitelist: " + iss); } if (blacklist.contains(iss)) { throw new AuthenticationServiceException("Issuer was in blacklist: " + iss); } return new IssuerServiceResponse(iss, request.getParameter("login_hint"), request.getParameter("target_link_uri")); } else { try { String redirectUri = request.getRequestURL().toString(); URIBuilder builder = new URIBuilder(accountChooserUrl); builder.addParameter("redirect_uri", redirectUri); return new IssuerServiceResponse(builder.build().toString()); } catch (URISyntaxException e) { throw new AuthenticationServiceException("Account Chooser URL is not valid", e); } } } }
ThirdPartyIssuerService implements IssuerService { @Override public IssuerServiceResponse getIssuer(HttpServletRequest request) { String iss = request.getParameter("iss"); if (!Strings.isNullOrEmpty(iss)) { if (!whitelist.isEmpty() && !whitelist.contains(iss)) { throw new AuthenticationServiceException("Whitelist was nonempty, issuer was not in whitelist: " + iss); } if (blacklist.contains(iss)) { throw new AuthenticationServiceException("Issuer was in blacklist: " + iss); } return new IssuerServiceResponse(iss, request.getParameter("login_hint"), request.getParameter("target_link_uri")); } else { try { String redirectUri = request.getRequestURL().toString(); URIBuilder builder = new URIBuilder(accountChooserUrl); builder.addParameter("redirect_uri", redirectUri); return new IssuerServiceResponse(builder.build().toString()); } catch (URISyntaxException e) { throw new AuthenticationServiceException("Account Chooser URL is not valid", e); } } }  }
ThirdPartyIssuerService implements IssuerService { @Override public IssuerServiceResponse getIssuer(HttpServletRequest request) { String iss = request.getParameter("iss"); if (!Strings.isNullOrEmpty(iss)) { if (!whitelist.isEmpty() && !whitelist.contains(iss)) { throw new AuthenticationServiceException("Whitelist was nonempty, issuer was not in whitelist: " + iss); } if (blacklist.contains(iss)) { throw new AuthenticationServiceException("Issuer was in blacklist: " + iss); } return new IssuerServiceResponse(iss, request.getParameter("login_hint"), request.getParameter("target_link_uri")); } else { try { String redirectUri = request.getRequestURL().toString(); URIBuilder builder = new URIBuilder(accountChooserUrl); builder.addParameter("redirect_uri", redirectUri); return new IssuerServiceResponse(builder.build().toString()); } catch (URISyntaxException e) { throw new AuthenticationServiceException("Account Chooser URL is not valid", e); } } }  @Override IssuerServiceResponse getIssuer(HttpServletRequest request); String getAccountChooserUrl(); void setAccountChooserUrl(String accountChooserUrl); Set<String> getWhitelist(); void setWhitelist(Set<String> whitelist); Set<String> getBlacklist(); void setBlacklist(Set<String> blacklist); @PostConstruct void afterPropertiesSet(); }
ThirdPartyIssuerService implements IssuerService { @Override public IssuerServiceResponse getIssuer(HttpServletRequest request) { String iss = request.getParameter("iss"); if (!Strings.isNullOrEmpty(iss)) { if (!whitelist.isEmpty() && !whitelist.contains(iss)) { throw new AuthenticationServiceException("Whitelist was nonempty, issuer was not in whitelist: " + iss); } if (blacklist.contains(iss)) { throw new AuthenticationServiceException("Issuer was in blacklist: " + iss); } return new IssuerServiceResponse(iss, request.getParameter("login_hint"), request.getParameter("target_link_uri")); } else { try { String redirectUri = request.getRequestURL().toString(); URIBuilder builder = new URIBuilder(accountChooserUrl); builder.addParameter("redirect_uri", redirectUri); return new IssuerServiceResponse(builder.build().toString()); } catch (URISyntaxException e) { throw new AuthenticationServiceException("Account Chooser URL is not valid", e); } } }  @Override IssuerServiceResponse getIssuer(HttpServletRequest request); String getAccountChooserUrl(); void setAccountChooserUrl(String accountChooserUrl); Set<String> getWhitelist(); void setWhitelist(Set<String> whitelist); Set<String> getBlacklist(); void setBlacklist(Set<String> blacklist); @PostConstruct void afterPropertiesSet();  }