类 SecurityUtils

java.lang.Object
cn.herodotus.engine.oauth2.core.utils.SecurityUtils

public class SecurityUtils extends Object
作者:
gengwei.zheng
Date:
2018-3-8
  • 字段详细资料

  • 构造器详细资料

    • SecurityUtils

      public SecurityUtils()
  • 方法详细资料

    • encrypt

      public static String encrypt(String password)
      密码加密
      参数:
      password - 明文密码
      返回:
      已加密密码
    • matches

      public static boolean matches(String rawPassword, String encodedPassword)
      密码验证
      参数:
      rawPassword - 原始密码
      encodedPassword - 加密后的密码
      返回:
      密码是否匹配
    • getSecurityContext

      public static org.springframework.security.core.context.SecurityContext getSecurityContext()
    • getAuthentication

      public static org.springframework.security.core.Authentication getAuthentication()
    • isAuthenticated

      public static boolean isAuthenticated()
    • getDetails

      public static Object getDetails()
    • reloadAuthority

      public static void reloadAuthority(HerodotusUser newHerodotusUser)
      当用户角色发生变化,或者用户角色对应的权限发生变化,那么就从数据库中重新查询用户相关信息
      参数:
      newHerodotusUser - 从数据库中重新查询并生成的用户信息
    • getPrincipal

      public static HerodotusUser getPrincipal()
      获取认证用户信息

      该方法仅能获取有限用户信息。从实用角度建议使用本系统提供的其它获取用户方式。

      返回:
      自定义 UserDetails HerodotusUser
    • getUsername

      public static String getUsername()
    • getPrincipals

      public static HerodotusUser getPrincipals()
    • getUserId

      public static String getUserId()
    • whitelistToAntMatchers

      public static String[] whitelistToAntMatchers(List<String> list)
    • wellFormRolePrefix

      public static String wellFormRolePrefix(String content)
    • wellFormPrefix

      public static String wellFormPrefix(String content, String prefix)