本文整理汇总了Java中org.springframework.security.openid.OpenIDAttribute类的典型用法代码示例。如果您正苦于以下问题:Java OpenIDAttribute类的具体用法?Java OpenIDAttribute怎么用?Java OpenIDAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpenIDAttribute类属于org.springframework.security.openid包,在下文中一共展示了OpenIDAttribute类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createAttributeList
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
/**
* A list of OpenID attributes to send in a request.
* @param identifier a user identifier
* @return a list of attributes
*/
public List<OpenIDAttribute> createAttributeList(String identifier) {
List<OpenIDAttribute> list = new LinkedList<>();
if (identifier != null && identifier.matches("https://www.google.com/.*")) {
OpenIDAttribute email = new OpenIDAttribute("email", "http://axschema.org/contact/email");
OpenIDAttribute first = new OpenIDAttribute("firstname", "http://axschema.org/namePerson/first");
OpenIDAttribute last = new OpenIDAttribute("lastname", "http://axschema.org/namePerson/last");
email.setCount(1);
email.setRequired(true);
first.setRequired(true);
last.setRequired(true);
list.add(email);
list.add(first);
list.add(last);
}
return list;
}
开发者ID:Erudika,项目名称:para,代码行数:22,代码来源:SimpleAxFetchListFactory.java
示例2: getAttribute
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
/**
* Looks for attribute with given name in given list
*
* @param attributes list of OpenId attributes
* @param attributeName of attribute we're looking for
* @return string with attribute value if attribute with given
* name exists, otherwise return empty string
*/
private String getAttribute(List<OpenIDAttribute> attributes, String attributeName) {
String attributeValue = "";
for (OpenIDAttribute attribute : attributes) {
if (attribute.getName() != null && (attribute.getName().equals("ax" + attributeName) || attribute.getName().equals("ae" + attributeName))) {
attributeValue = attribute.getValues().get(0);
}
}
return attributeValue;
}
开发者ID:motech,项目名称:motech,代码行数:18,代码来源:MotechOpenIdUserDetailsService.java
示例3: loadUserDetails_valid
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
@Test
public void loadUserDetails_valid() {
final User authUser=new UserImpl(USER_ID,USER_NAME);
authUser.setOpenId(OPENID_VALID);
expect(userRepository.getByOpenId(OPENID_VALID)).andReturn(authUser).anyTimes();
replay(userRepository);
OpenIDAuthenticationToken postAuthToken = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SUCCESS,OPENID_VALID,
"Some message", new ArrayList<OpenIDAttribute>());
UserDetails result = service.loadUserDetails(postAuthToken);
assertThat((User)result, is(sameInstance(authUser)));
verify(userRepository);
}
开发者ID:apache,项目名称:rave,代码行数:13,代码来源:DefaultUserServiceTest.java
示例4: loadUserDetails_invalid_exception
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
@Test(expected = UsernameNotFoundException.class)
public void loadUserDetails_invalid_exception() {
expect(userRepository.getByOpenId(OPENID_INVALID)).andReturn(null);
replay(userRepository);
OpenIDAuthenticationToken postAuthToken = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SUCCESS,OPENID_INVALID,
"Some message", new ArrayList<OpenIDAttribute>());
service.loadUserDetails(postAuthToken);
verify(userRepository);
}
开发者ID:apache,项目名称:rave,代码行数:10,代码来源:DefaultUserServiceTest.java
示例5: createTemporaryUser
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的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
示例6: setup
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
@Before
public void setup() {
request = new MockHttpServletRequest();
response = new MockHttpServletResponse();
handler = new OpenIDAuthenticationFailureHandler();
postAuthToken = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SUCCESS,NON_REGISTERED_OPENID_USER,
MESSAGE, new ArrayList<OpenIDAttribute>());
authException = new UsernameNotFoundException("");
}
开发者ID:apache,项目名称:rave,代码行数:10,代码来源:OpenIDAuthenticationFailureHandlerTest.java
示例7: loadUserDetails
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
@Override
public UserDetails loadUserDetails(AbstractAuthenticationToken token)
throws UsernameNotFoundException {
GameonUser user = new GameonUser(token.getName(), "", token.getAuthorities() );
// OpenIDAuthenticationToken
if(token instanceof OpenIDAuthenticationToken){
List<OpenIDAttribute> attributes = ((OpenIDAuthenticationToken)token).getAttributes();
user.setOpenIDAttributes(attributes);
}
return user;
}
开发者ID:dfci-cccb,项目名称:game-on,代码行数:15,代码来源:DummyUserDetailsService.java
示例8: getEmail
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
public String getEmail() {
if(email==null && openIDAttributes!=null)
for(OpenIDAttribute attribute : openIDAttributes)
if(attribute.getName().equalsIgnoreCase("email"))
if(attribute.getValues().size()>0)
return attribute.getValues().get(0);
return email;
}
开发者ID:dfci-cccb,项目名称:game-on,代码行数:10,代码来源:GameonUser.java
示例9: setUpEmailAddress
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的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
示例10: getAttributeValue
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的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
示例11: getOpenIDAttributes
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
public List<OpenIDAttribute> getOpenIDAttributes() {
return openIDAttributes;
}
开发者ID:dfci-cccb,项目名称:game-on,代码行数:4,代码来源:GameonUser.java
示例12: setOpenIDAttributes
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
public void setOpenIDAttributes(List<OpenIDAttribute> openIDAttributes) {
this.openIDAttributes = openIDAttributes;
}
开发者ID:dfci-cccb,项目名称:game-on,代码行数:4,代码来源:GameonUser.java
示例13: setContainsAndAttributeHasValue
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
private boolean setContainsAndAttributeHasValue(Set<String> emailAddressAttributeNames, OpenIDAttribute openIDAttribute) {
return emailAddressAttributeNames.contains(openIDAttribute.getName()) && attributeHasValue(openIDAttribute);
}
开发者ID:pillingworthz,项目名称:ifictionary,代码行数:4,代码来源:NormalizedOpenIdAttributesBuilder.java
示例14: attributeHasValue
import org.springframework.security.openid.OpenIDAttribute; //导入依赖的package包/类
private boolean attributeHasValue(OpenIDAttribute openIDAttribute) {
return openIDAttribute.getValues() != null && openIDAttribute.getValues().size() > 0;
}
开发者ID:pillingworthz,项目名称:ifictionary,代码行数:4,代码来源:NormalizedOpenIdAttributesBuilder.java
注:本文中的org.springframework.security.openid.OpenIDAttribute类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论