|| !authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) { return Collections.emptyList();
@Test public void fetchAttributesReturnsExpectedValues() throws Exception { OpenID4JavaConsumer consumer = new OpenID4JavaConsumer( new NullAxFetchListFactory()); Message msg = mock(Message.class); FetchResponse fr = mock(FetchResponse.class); when(msg.hasExtension(AxMessage.OPENID_NS_AX)).thenReturn(true); when(msg.getExtension(AxMessage.OPENID_NS_AX)).thenReturn(fr); when(fr.getAttributeValues("a")).thenReturn(Arrays.asList("x", "y")); List<OpenIDAttribute> fetched = consumer.fetchAxAttributes(msg, attributes); assertThat(fetched).hasSize(1); assertThat(fetched.get(0).getValues()).hasSize(2); }
@Test(expected = OpenIDConsumerException.class) public void messageExceptionFetchingAttributesRaisesOpenIDException() throws Exception { OpenID4JavaConsumer consumer = new OpenID4JavaConsumer( new NullAxFetchListFactory()); Message msg = mock(Message.class); FetchResponse fr = mock(FetchResponse.class); when(msg.hasExtension(AxMessage.OPENID_NS_AX)).thenReturn(true); when(msg.getExtension(AxMessage.OPENID_NS_AX)) .thenThrow(new MessageException("")); when(fr.getAttributeValues("a")).thenReturn(Arrays.asList("x", "y")); consumer.fetchAxAttributes(msg, attributes); }
|| !authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) { return Collections.emptyList();
if (hasExtension(extensionTypeUri))
if (hasExtension(extensionTypeUri))
if (authResponse.hasExtension(AxMessage.OPENID_NS_AX)) { if (authResponse.hasExtension(PapeResponse.OPENID_NS_PAPE)) {
if (hasExtension(extensionTypeUri))
if (hasExtension(extensionTypeUri))
ParameterList extension = new ParameterList(); if (hasExtension(extensionTypeUri)) { String extensionAlias = getExtensionAlias(extensionTypeUri);
String typeUri = extension.getTypeUri(); if (hasExtension(typeUri)) { throw new MessageException("Extension already present: " + typeUri);
if (hasExtension(typeUri)) throw new MessageException("Extension already present: " + typeUri);
if (hasExtension(typeUri)) throw new MessageException("Extension already present: " + typeUri);
if (hasExtension(typeUri)) throw new MessageException("Extension already present: " + typeUri);
if (hasExtension(typeUri)) throw new MessageException("Extension already present: " + typeUri);