当前位置: 首页>>代码示例>>Java>>正文


Java OpenIDAuthenticationToken.getAttributes方法代码示例

本文整理汇总了Java中org.springframework.security.openid.OpenIDAuthenticationToken.getAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java OpenIDAuthenticationToken.getAttributes方法的具体用法?Java OpenIDAuthenticationToken.getAttributes怎么用?Java OpenIDAuthenticationToken.getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.security.openid.OpenIDAuthenticationToken的用法示例。


在下文中一共展示了OpenIDAuthenticationToken.getAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTemporaryUser

import org.springframework.security.openid.OpenIDAuthenticationToken; //导入方法依赖的package包/类
private User createTemporaryUser(OpenIDAuthenticationToken token,
		final String openId) {
	final List<OpenIDAttribute> attributes = token.getAttributes();
	String email = null;
	String firstName = null;
	String lastName = null;
	String displayName = null;
	for (OpenIDAttribute attribute : attributes) {
		if ("email".equals(attribute.getName())
				&& !attribute.getValues().isEmpty()) {
			email = attribute.getValues().get(0);
		} else if ("firstname".equals(attribute.getName())
				&& !attribute.getValues().isEmpty()) {
			firstName = attribute.getValues().get(0);
		} else if ("lastname".equals(attribute.getName())
				&& !attribute.getValues().isEmpty()) {
			lastName = attribute.getValues().get(0);
		} else if ("fullname".equals(attribute.getName())
				&& !attribute.getValues().isEmpty()) {
			displayName = attribute.getValues().get(0);
		}
	}
	User user = new UserImpl();
	String username = StringUtils.substringAfter(openId, "://").replace("/", "");
	if (username.length() > 35) {
		username = username.substring(0, 35);
	}
	if (displayName == null && firstName != null && lastName != null) {
		displayName = firstName + " " + lastName;
	}
	user.setUsername(username);
	user.setEmail(email);
	user.setGivenName(firstName);
	user.setFamilyName(lastName);
	user.setDisplayName(displayName);
	user.setOpenId(openId);

	return user;
}
 
开发者ID:apache,项目名称:rave,代码行数:40,代码来源:OpenIDAuthenticationFailureHandler.java

示例2: setUpEmailAddress

import org.springframework.security.openid.OpenIDAuthenticationToken; //导入方法依赖的package包/类
private String setUpEmailAddress(OpenIDAuthenticationToken openIdAuthenticationToken) {
    for (OpenIDAttribute openIDAttribute : openIdAuthenticationToken.getAttributes()) {
        if (setContainsAndAttributeHasValue(emailAddressAttributeNames, openIDAttribute)) {
            return openIDAttribute.getValues().get(0);
        }
    }
    return null;
}
 
开发者ID:pillingworthz,项目名称:ifictionary,代码行数:9,代码来源:NormalizedOpenIdAttributesBuilder.java

示例3: getAttributeValue

import org.springframework.security.openid.OpenIDAuthenticationToken; //导入方法依赖的package包/类
private String getAttributeValue(OpenIDAuthenticationToken openIdAuthenticationToken, Set<String> stringSet) {
    for (OpenIDAttribute openIDAttribute : openIdAuthenticationToken.getAttributes()) {
        if (attributeHasValue(openIDAttribute)) {
            if (stringSet.contains(openIDAttribute.getName())) {
                return openIDAttribute.getValues().get(0);
            }
        }
    }
    return null;
}
 
开发者ID:pillingworthz,项目名称:ifictionary,代码行数:11,代码来源:NormalizedOpenIdAttributesBuilder.java


注:本文中的org.springframework.security.openid.OpenIDAuthenticationToken.getAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。