DiscoveryInformation information = consumerManager.associate(discoveries); req.getSession().setAttribute(DISCOVERY_INFO_KEY, information);
@SuppressWarnings("deprecation") @Test public void beginConsumptionCreatesExpectedSessionData() throws Exception { ConsumerManager mgr = mock(ConsumerManager.class); AuthRequest authReq = mock(AuthRequest.class); DiscoveryInformation di = mock(DiscoveryInformation.class); when(mgr.authenticate(any(DiscoveryInformation.class), any(), any())) .thenReturn(authReq); when(mgr.associate(any())).thenReturn(di); OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, new MockAttributesFactory()); MockHttpServletRequest request = new MockHttpServletRequest(); consumer.beginConsumption(request, "", "", ""); assertThat(request.getSession().getAttribute( "SPRING_SECURITY_OPEN_ID_ATTRIBUTES_FETCH_LIST")).isEqualTo(attributes); assertThat( request.getSession().getAttribute(DiscoveryInformation.class.getName())).isEqualTo(di); // Check with empty attribute fetch list consumer = new OpenID4JavaConsumer(mgr, new NullAxFetchListFactory()); request = new MockHttpServletRequest(); consumer.beginConsumption(request, "", "", ""); }
DiscoveryInformation discovered = associate(discoveries);
DiscoveryInformation discovered = associate(discoveries);
throws ConsumerException, MessageException { DiscoveryInformation discovered = associate(discoveries);
DiscoveryInformation discovered = associate(discoveries);
while (itr.hasNext() && attemptsLeft > 0) { discovered = (DiscoveryInformation) itr.next(); attemptsLeft -= associate(discovered, attemptsLeft);
private DiscoveryInformation performDiscovery(String openId) { try { ConsumerManager consumerManager = getConsumerManager(); List<?> discoveries = consumerManager.discover(openId); return consumerManager.associate(discoveries); } catch (DiscoveryException e) { throw new WicketRuntimeException("discovery failed", e); } }
DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries); session.setAttribute("discovery", discovered); try {
DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries); session.setAttribute("discovery", discovered); try {
DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries); session.setAttribute("discovery", discovered); try {
DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries); session.setAttribute("discovery", discovered); try {
/** * Associate with a list of open id providers * * @param adapter Protocol adapter (such as http) * @param listOfProviders (a list of providers from discovery) * @return * @throws OpenIDConsumerException * @throws OpenIDLifeCycleException */ public OpenIDProviderInformation associate(OpenIDProtocolAdapter adapter, OpenIDProviderList listOfProviders) throws OpenIDConsumerException, OpenIDLifeCycleException { OpenIDLifecycle lifeCycle = null; if (adapter instanceof OpenIDLifecycle) { lifeCycle = (OpenIDLifecycle) adapter; } List<DiscoveryInformation> discoveries = listOfProviders.get(); if (discoveries.size() == 0) throw new OpenIDConsumerException("No open id endpoints discovered"); // attempt to associate with the OpenID provider // and retrieve one service endpoint for authentication DiscoveryInformation discovered = consumerManager.associate(discoveries); // store the discovery information in the user's session for later use // leave out for stateless operation / if there is no session if (lifeCycle != null) { OpenIDLifecycleEvent ev = new OpenIDLifecycleEvent(TYPE.SESSION, OP.ADD, CONST.OPENID_DISC.get(), discovered); lifeCycle.handle(ev); } return new OpenIDProviderInformation(discovered); }
/** * Associate with a list of open id providers * * @param adapter Protocol adapter (such as http) * @param listOfProviders (a list of providers from discovery) * @return * @throws OpenIDConsumerException * @throws OpenIDLifeCycleException */ public OpenIDProviderInformation associate(OpenIDProtocolAdapter adapter, OpenIDProviderList listOfProviders) throws OpenIDConsumerException, OpenIDLifeCycleException { OpenIDLifecycle lifeCycle = null; if (adapter instanceof OpenIDLifecycle) { lifeCycle = (OpenIDLifecycle) adapter; } List<DiscoveryInformation> discoveries = listOfProviders.get(); if (discoveries.size() == 0) throw new OpenIDConsumerException("No open id endpoints discovered"); // attempt to associate with the OpenID provider // and retrieve one service endpoint for authentication DiscoveryInformation discovered = consumerManager.associate(discoveries); // store the discovery information in the user's session for later use // leave out for stateless operation / if there is no session if (lifeCycle != null) { OpenIDLifecycleEvent ev = new OpenIDLifecycleEvent(TYPE.SESSION, OP.ADD, CONST.OPENID_DISC.get(), discovered); lifeCycle.handle(ev); } return new OpenIDProviderInformation(discovered); }
DiscoveryInformation discovered = consumerManager.associate(discoveries);
DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries); session.setNote("discovery", discovered); try {
DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries); session.setNote("discovery", discovered); try {
DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries); session.setNote("discovery", discovered); try {
DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries); session.setNote("discovery", discovered); try {
discovered = manager.associate(discoveries);