Search in sources :

Example 1 with EcBaseOauthUserDTO

use of com.easy.cloud.core.oauth.client.base.pojo.dto.EcBaseOauthUserDTO 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;
}
Also used : EcBaseOauthUserDTO(com.easy.cloud.core.oauth.client.base.pojo.dto.EcBaseOauthUserDTO) SysUserDTO(com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO)

Aggregations

EcBaseOauthUserDTO (com.easy.cloud.core.oauth.client.base.pojo.dto.EcBaseOauthUserDTO)1 SysUserDTO (com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO)1