新增学校统一身份认证登录
- GxmuAuthProperties 承载接入配置,认证客户端按微服务认证平台 API v2.3 调 cas.gxmu.edu.cn - /api/sso/login 与 /api/sso/available 免鉴权放行 - 校验通过后按学号认领学生,名册外的账号默认拒绝登录
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.gxwebsoft.gxmu.auth;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.result.LoginResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 学校统一身份认证登录接口。
|
||||
*
|
||||
* <p>小程序端不再走 CAS 网页跳转,而是直接收集 学号 + 统一身份认证密码交给后端,
|
||||
* 由后端调认证平台 {@code /v2/checkPwd}、{@code /v2/getUserInfo} 完成校验。
|
||||
* 密码只用于当次校验,本系统不保存。
|
||||
*
|
||||
* @author Codex
|
||||
* @since 2026-09-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/sso")
|
||||
@Api(tags = "学校统一身份认证登录API")
|
||||
public class SsoLoginController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private SsoLoginService ssoLoginService;
|
||||
|
||||
@ApiOperation("学校统一身份认证登录(学号 + 统一身份认证密码)")
|
||||
@PostMapping("/login")
|
||||
public ApiResult<LoginResult> login(@RequestBody SsoLoginParam param, HttpServletRequest request) {
|
||||
return success("登录成功", ssoLoginService.login(param.getUsername(), param.getPassword(),
|
||||
getTenantId(), request));
|
||||
}
|
||||
|
||||
@ApiOperation("学校统一身份认证登录是否可用")
|
||||
@GetMapping("/available")
|
||||
public ApiResult<Boolean> available() {
|
||||
return success(ssoLoginService.available());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user