本文整理汇总了Java中com.github.ulisesbocchio.spring.boot.security.saml.user.SAMLUserDetails类的典型用法代码示例。如果您正苦于以下问题:Java SAMLUserDetails类的具体用法?Java SAMLUserDetails怎么用?Java SAMLUserDetails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SAMLUserDetails类属于com.github.ulisesbocchio.spring.boot.security.saml.user包,在下文中一共展示了SAMLUserDetails类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: userDetailsService
import com.github.ulisesbocchio.spring.boot.security.saml.user.SAMLUserDetails; //导入依赖的package包/类
@Bean
public SAMLUserDetailsService userDetailsService() {
return new SAMLUserDetailsService() {
@Override
public Object loadUserBySAML(SAMLCredential samlCredential) throws UsernameNotFoundException {
return new SAMLUserDetails(samlCredential) {
@Override
public Map<String, String> getAttributes() {
return samlCredential.getAttributes().stream()
.collect(Collectors.toMap(Attribute::getName, this::getValue));
}
private String getValue(Attribute attribute) {
return Optional.ofNullable(getAttribute(attribute.getName())).orElse("");
}
};
}
};
}
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml-samples,代码行数:20,代码来源:Auth0SSODemoApplication.java
示例2: home
import com.github.ulisesbocchio.spring.boot.security.saml.user.SAMLUserDetails; //导入依赖的package包/类
@RequestMapping("/home")
public ModelAndView home(@SAMLUser SAMLUserDetails user) {
ModelAndView homeView = new ModelAndView("home");
homeView.addObject("userId", user.getUsername());
homeView.addObject("samlAttributes", user.getAttributes());
return homeView;
}