|
|
@ -16,13 +16,11 @@ import me.zhyd.oauth.request.AuthRequest; |
|
|
import me.zhyd.oauth.utils.AuthStateUtils; |
|
|
import me.zhyd.oauth.utils.AuthStateUtils; |
|
|
import org.dromara.common.core.constant.SystemConstants; |
|
|
import org.dromara.common.core.constant.SystemConstants; |
|
|
import org.dromara.common.core.domain.R; |
|
|
import org.dromara.common.core.domain.R; |
|
|
import org.dromara.common.core.domain.model.LoginBody; |
|
|
import org.dromara.common.core.domain.model.*; |
|
|
import org.dromara.common.core.domain.model.LoginUser; |
|
|
|
|
|
import org.dromara.common.core.domain.model.RegisterBody; |
|
|
|
|
|
import org.dromara.common.core.domain.model.SocialLoginBody; |
|
|
|
|
|
import org.dromara.common.core.utils.*; |
|
|
import org.dromara.common.core.utils.*; |
|
|
import org.dromara.common.encrypt.annotation.ApiEncrypt; |
|
|
import org.dromara.common.encrypt.annotation.ApiEncrypt; |
|
|
import org.dromara.common.encrypt.utils.EncryptUtils; |
|
|
import org.dromara.common.encrypt.utils.EncryptUtils; |
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
import org.dromara.common.json.utils.JsonUtils; |
|
|
import org.dromara.common.json.utils.JsonUtils; |
|
|
import org.dromara.common.ratelimiter.annotation.RateLimiter; |
|
|
import org.dromara.common.ratelimiter.annotation.RateLimiter; |
|
|
import org.dromara.common.ratelimiter.enums.LimitType; |
|
|
import org.dromara.common.ratelimiter.enums.LimitType; |
|
|
@ -96,6 +94,16 @@ public class AuthController { |
|
|
public R<LoginVo> login(@RequestBody String body) { |
|
|
public R<LoginVo> login(@RequestBody String body) { |
|
|
LoginBody loginBody = JsonUtils.parseObject(body, LoginBody.class); |
|
|
LoginBody loginBody = JsonUtils.parseObject(body, LoginBody.class); |
|
|
ValidatorUtils.validate(loginBody); |
|
|
ValidatorUtils.validate(loginBody); |
|
|
|
|
|
|
|
|
|
|
|
// 仅允许admin登录限制
|
|
|
|
|
|
String loginAccount = configService.selectConfigByKey("login.account"); |
|
|
|
|
|
if ("1".equals(loginAccount)) { |
|
|
|
|
|
PasswordLoginBody passwordLoginBody = JsonUtils.parseObject(body, PasswordLoginBody.class); |
|
|
|
|
|
if (!"admin".equals(passwordLoginBody.getUsername())) { |
|
|
|
|
|
return R.fail("当前仅允许管理员登录"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 授权类型和客户端id
|
|
|
// 授权类型和客户端id
|
|
|
String clientId = loginBody.getClientId(); |
|
|
String clientId = loginBody.getClientId(); |
|
|
String grantType = loginBody.getGrantType(); |
|
|
String grantType = loginBody.getGrantType(); |
|
|
|