| | |
| | | } |
| | | String requestPath = SaHolder.getRequest().getRequestPath(); |
| | | if (isAppApi(requestPath)) { |
| | | if (isPublicAppApi(requestPath)) { |
| | | return; |
| | | } |
| | | StpAppUserUtil.checkLogin(); |
| | | // APP 端允许游客访问,只有真正需要用户身份的接口才在业务层显式要求登录。 |
| | | return; |
| | | } |
| | | if (isPublicAdminApi(requestPath)) { |
| | |
| | | */ |
| | | private boolean isAppApi(String requestPath) { |
| | | return requestPath.startsWith("/api/app/") || requestPath.startsWith("/api/v1/app/"); |
| | | } |
| | | |
| | | /** |
| | | * 判断当前 APP 路由是否允许匿名访问。 |
| | | */ |
| | | private boolean isPublicAppApi(String requestPath) { |
| | | return requestPath.startsWith("/api/app/auth/") |
| | | || requestPath.startsWith("/api/v1/app/auth/") |
| | | || requestPath.startsWith("/api/app/register/") |
| | | || requestPath.startsWith("/api/v1/app/register/") |
| | | || "/api/app/version/check".equals(requestPath) |
| | | || "/api/v1/app/version/check".equals(requestPath); |
| | | } |
| | | |
| | | /** |