org.openid4java.message.Message.getExtension()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(267)

本文整理了Java中org.openid4java.message.Message.getExtension()方法的一些代码示例,展示了Message.getExtension()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getExtension()方法的具体详情如下:
包路径:org.openid4java.message.Message
类名称:Message
方法名:getExtension

Message.getExtension介绍

[英]Gets a MessageExtension for the specified Type URI if an implementation is available, or null otherwise.

The returned object will contain the parameters from the message belonging to the specified extension.
[中]如果实现可用,则获取指定类型URI的MessageExtension,否则为null。
返回的对象将包含消息中属于指定扩展名的参数。

代码示例

代码示例来源:origin: spring-projects/spring-security

MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);
if (ext instanceof FetchResponse) {
  FetchResponse fetchResp = (FetchResponse) ext;

代码示例来源:origin: spring-projects/spring-security

@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);
}

代码示例来源:origin: spring-projects/spring-security

@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);
}

代码示例来源:origin: org.springframework.security/spring-security-openid

MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);
if (ext instanceof FetchResponse) {
  FetchResponse fetchResp = (FetchResponse) ext;

代码示例来源:origin: be.fedict.eid-idp/eid-idp-sp-protocol-openid

.getExtension(AxMessage.OPENID_NS_AX);
if (messageExtension instanceof FetchResponse) {
    .getExtension(PapeResponse.OPENID_NS_PAPE);
if (messageExtension instanceof PapeResponse) {

相关文章