use of com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO in project dq-easy-cloud by dq-open-cloud.
the class SysUserController method clearCachedAuthorizationInfo.
@RequestMapping(value = "clearCachedAuthorizationInfo")
public EcBaseServiceResult clearCachedAuthorizationInfo(@RequestBody SysUserDTO sysUserDTO) {
SysUserDTO sysUserDTOFromTable = sysUserService.findByUsername(sysUserDTO.getUsername());
authorityManager.clearAuthorizationInfo(sysUserDTOFromTable);
return EcBaseServiceResult.newInstanceOfSucResult(sysUserDTOFromTable);
}
use of com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO in project dq-easy-cloud by dq-open-cloud.
the class SysResourceServiceImpl method listPermissionOfCurrentUser.
@Override
public EcBaseServiceResult listPermissionOfCurrentUser() {
Subject subject = SecurityUtils.getSubject();
SysUserDTO sysUserDTO = (SysUserDTO) subject.getPrincipal();
List<SysRoleDTO> roles = sysRoleService.findByUserId(sysUserDTO.getId());
Set<Integer> roleNos = new HashSet<>();
for (SysRoleDTO roleDTO : roles) {
roleNos.add(roleDTO.getRoleNo());
}
List<SysResourceDTO> resourceDTOS = findByRoleNos(new ArrayList<>(roleNos));
return EcBaseServiceResult.newInstanceOfSucResult(resourceDTOS);
}
use of com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO in project dq-easy-cloud by dq-open-cloud.
the class EcAuthorityRealm method doGetAuthenticationInfoOauth2Token.
/**
* <p>
* 使用oauth2.0token授权模式登陆
* </p>
*
* @return org.apache.shiro.authc.AuthenticationInfo
* @author daiqi
* @date 2018/6/29 17:49
*/
protected AuthenticationInfo doGetAuthenticationInfoOauth2Token(EcBaseOauthToken oauth2Token) {
EcBaseOauthResourceDTO<Object> oauthResourceDTO = oauthManager.getOauthResourceDTO(oauth2Token);
EcAssert.verifyObjNull(oauthResourceDTO, "oauthResourceDTO");
EcBaseOauthUserDTO oauthUserDTO = oauthResourceDTO.getTObj();
SysUserDTO sysUserDTO = new SysUserDTO();
sysUserDTO.setUsername(oauthUserDTO.getOpenid());
sysUserDTO.setPassword(EcAuthorityUtils.encryptOfMD5(oauth2Token.getAuthCode(), oauthUserDTO.getOpenid()));
sysUserDTO.setSalt(oauthUserDTO.getOpenid());
SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(sysUserDTO, sysUserDTO.getPassword(), ByteSource.Util.bytes(sysUserDTO.getSalt()), sysUserDTO.getAuthCacheKey());
return authenticationInfo;
}
Aggregations