use of org.apereo.cas.authentication.support.DefaultCasProtocolAttributeEncoder in project cas by apereo.
the class Cas30ResponseViewTests method renderView.
private Map<?, ?> renderView() throws Exception {
final ModelAndView modelAndView = this.getModelAndViewUponServiceValidationWithSecurePgtUrl();
final MockHttpServletRequest req = new MockHttpServletRequest(new MockServletContext());
req.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, new GenericWebApplicationContext(req.getServletContext()));
final ProtocolAttributeEncoder encoder = new DefaultCasProtocolAttributeEncoder(this.servicesManager, NoOpCipherExecutor.getInstance());
final View viewDelegated = new View() {
@Override
public String getContentType() {
return MediaType.TEXT_HTML_VALUE;
}
@Override
public void render(final Map<String, ?> map, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
map.forEach(request::setAttribute);
}
};
final Cas30ResponseView view = new Cas30ResponseView(true, encoder, servicesManager, "attribute", viewDelegated, true);
final MockHttpServletResponse resp = new MockHttpServletResponse();
view.render(modelAndView.getModel(), req, resp);
return (Map<?, ?>) req.getAttribute(CasProtocolConstants.VALIDATION_CAS_MODEL_ATTRIBUTE_NAME_ATTRIBUTES);
}
use of org.apereo.cas.authentication.support.DefaultCasProtocolAttributeEncoder in project cas by apereo.
the class Saml10SuccessResponseViewTests method setUp.
@Before
public void setUp() throws Exception {
final List<RegisteredService> list = new ArrayList<>();
list.add(RegisteredServiceTestUtils.getRegisteredService("https://.+"));
final InMemoryServiceRegistry dao = new InMemoryServiceRegistry();
dao.setRegisteredServices(list);
final DefaultServicesManager mgmr = new DefaultServicesManager(dao);
mgmr.load();
this.response = new Saml10SuccessResponseView(new DefaultCasProtocolAttributeEncoder(mgmr, NoOpCipherExecutor.getInstance()), mgmr, "attribute", new Saml10ObjectBuilder(configBean), new DefaultArgumentExtractor(new SamlServiceFactory()), StandardCharsets.UTF_8.name(), 1000, "testIssuer", "whatever");
}
Aggregations