本文整理匯總了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;
}