| | |
| | | import javax.net.ssl.SSLContext; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.PropertyNamingStrategy; |
| | | import com.alibaba.fastjson.parser.ParserConfig; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.config.SsoBean; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.framework.model.SsoOauthTokenModel; |
| | | import com.ruoyi.framework.model.SsoUserInfoModel; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.HttpStatus; |
| | |
| | | import org.apache.http.ssl.TrustStrategy; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 登录校验方法 |
| | |
| | | private RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | @Autowired |
| | | private SsoBean ssoBean; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | | /** |
| | | * 登录验证 |
| | |
| | | sysUser.setUserId(userId); |
| | | sysUser.setLoginIp(IpUtils.getIpAddr()); |
| | | sysUser.setLoginDate(DateUtils.getNowDate()); |
| | | userService.updateUserProfile(sysUser); |
| | | sysUserService.updateUserProfile(sysUser); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(userInfo.getEmployeeId(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.single.login.success"))); |
| | | redisTemplate.opsForValue().set("ssoOauthToken:idToken:" + userInfo.getEmployeeId(), tokenModel.getId_token(), 3, TimeUnit.DAYS); |
| | | // 生成token |
| | | return tokenService.createToken(null); |
| | | } |