org.hswebframework.web.authorization.Authentication.getRoles()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(169)

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

Authentication.getRoles介绍

暂无

代码示例

代码示例来源:origin: hs-web/hsweb-framework

/**
 * 根据id获取角色,角色不存在则返回null
 *
 * @param id 角色id
 * @return 角色信息
 */
default Optional<Role> getRole(String id) {
  if (null == id) {
    return Optional.empty();
  }
  return getRoles().stream()
      .filter(role -> role.getId().equals(id))
      .findAny();
}

代码示例来源:origin: hs-web/hsweb-framework

String[] real = conf.split("[:]", 2);
if (real.length < 2) {
  temp = authentication -> !authentication.getRoles().isEmpty();
} else {
  temp = AuthenticationPredicate.role(real[1]);

代码示例来源:origin: hs-web/hsweb-framework

.getRoles()
.stream()
.map(role -> allows.getOrDefault("roles", Collections.emptyMap()).get(role.getId()))

代码示例来源:origin: hs-web/hsweb-framework

? authentication.getRoles().stream()::anyMatch
    : authentication.getRoles().stream()::allMatch;
access = func.apply(role -> rolesDef.contains(role.getId()));

代码示例来源:origin: org.hswebframework.web/hsweb-authorization-basic

.getRoles()
.stream()
.map(role -> allows.getOrDefault("roles", Collections.emptyMap()).get(role.getId()))

代码示例来源:origin: org.hswebframework.web/hsweb-authorization-basic

? authentication.getRoles().stream()::anyMatch
    : authentication.getRoles().stream()::allMatch;
access = func.apply(role -> rolesDef.contains(role.getId()));

相关文章

微信公众号

最新文章

更多