feat: 新增移动端仪表板api

This commit is contained in:
fit2cloud-chenyw 2021-12-18 22:35:59 +08:00
parent adca61d450
commit 2365d3f24e
3 changed files with 30 additions and 15 deletions

View File

@ -12,12 +12,12 @@ public class ShiroServiceImpl implements ShiroService {
private final static String ANON = "anon"; private final static String ANON = "anon";
@Override @Override
public Map<String, String> loadFilterChainDefinitionMap() { public Map<String, String> loadFilterChainDefinitionMap() {
// 权限控制map // 权限控制map
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>(); Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
// 配置过滤:不会被拦截的链接 -> 放行 start ---------------------------------------------------------- // 配置过滤:不会被拦截的链接 -> 放行 start
// ----------------------------------------------------------
// 放行Swagger2页面需要放行这些 // 放行Swagger2页面需要放行这些
filterChainDefinitionMap.put("/doc.html**", "doc"); filterChainDefinitionMap.put("/doc.html**", "doc");
@ -42,17 +42,20 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/index.html", ANON); filterChainDefinitionMap.put("/index.html", ANON);
filterChainDefinitionMap.put("/link.html", ANON); filterChainDefinitionMap.put("/link.html", ANON);
// 获取主题信息
//获取主题信息
filterChainDefinitionMap.put("/plugin/theme/themes", ANON); filterChainDefinitionMap.put("/plugin/theme/themes", ANON);
filterChainDefinitionMap.put("/plugin/theme/items/**", ANON); filterChainDefinitionMap.put("/plugin/theme/items/**", ANON);
//验证链接 // 验证链接
filterChainDefinitionMap.put("/api/link/validate**", ANON); filterChainDefinitionMap.put("/api/link/validate**", ANON);
filterChainDefinitionMap.put("/api/map/areaEntitys/**", ANON); filterChainDefinitionMap.put("/api/map/areaEntitys/**", ANON);
filterChainDefinitionMap.put("/dataset/field/fieldValues/**", ANON); filterChainDefinitionMap.put("/dataset/field/fieldValues/**", ANON);
filterChainDefinitionMap.put("/linkJump/queryPanelJumpInfo/**", ANON); filterChainDefinitionMap.put("/linkJump/queryPanelJumpInfo/**", ANON);
filterChainDefinitionMap.put("/tempMobileLink/**", ANON);
filterChainDefinitionMap.put("/de-app/**", ANON);
filterChainDefinitionMap.put("/app.html", ANON);
filterChainDefinitionMap.put("/**/*.json", ANON); filterChainDefinitionMap.put("/**/*.json", ANON);
filterChainDefinitionMap.put("/system/ui/**", ANON); filterChainDefinitionMap.put("/system/ui/**", ANON);
filterChainDefinitionMap.put("/**/*.js", ANON); filterChainDefinitionMap.put("/**/*.js", ANON);
@ -70,7 +73,6 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/plugin/oidc/authInfo", ANON); filterChainDefinitionMap.put("/plugin/oidc/authInfo", ANON);
filterChainDefinitionMap.put("/sso/callBack*", ANON); filterChainDefinitionMap.put("/sso/callBack*", ANON);
filterChainDefinitionMap.put("/unauth", ANON); filterChainDefinitionMap.put("/unauth", ANON);
filterChainDefinitionMap.put("/display/**", ANON); filterChainDefinitionMap.put("/display/**", ANON);
filterChainDefinitionMap.put("/tokenExpired", ANON); filterChainDefinitionMap.put("/tokenExpired", ANON);
@ -82,7 +84,6 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/api/link/resourceDetail/**", "link"); filterChainDefinitionMap.put("/api/link/resourceDetail/**", "link");
filterChainDefinitionMap.put("/api/link/viewDetail/**", "link"); filterChainDefinitionMap.put("/api/link/viewDetail/**", "link");
filterChainDefinitionMap.put("/**", "authc"); filterChainDefinitionMap.put("/**", "authc");
filterChainDefinitionMap.put("/**", "jwt"); filterChainDefinitionMap.put("/**", "jwt");
@ -90,9 +91,9 @@ public class ShiroServiceImpl implements ShiroService {
return filterChainDefinitionMap; return filterChainDefinitionMap;
} }
@Override @Override
public void updatePermission(ShiroFilterFactoryBean shiroFilterFactoryBean, Integer roleId, Boolean isRemoveSession) { public void updatePermission(ShiroFilterFactoryBean shiroFilterFactoryBean, Integer roleId,
Boolean isRemoveSession) {
} }

View File

@ -19,6 +19,7 @@ import java.io.IOException;
@RequestMapping @RequestMapping
public class IndexController { public class IndexController {
private static final int FOR_EVER = 3600 * 24 * 30 * 12 * 10; // 10 years in second
@Resource @Resource
private DefaultLicenseService defaultLicenseService; private DefaultLicenseService defaultLicenseService;
@ -35,7 +36,6 @@ public class IndexController {
return "index.html"; return "index.html";
} }
@GetMapping("/deApi") @GetMapping("/deApi")
public String deApi() { public String deApi() {
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense(); F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense();
@ -59,5 +59,20 @@ public class IndexController {
} }
} }
@GetMapping("/tempMobileLink/{id}/{token}")
public void tempMobileLink(@PathVariable("id") String id, @PathVariable("token") String token) {
String url = "http://localhost:8081/#preview/" + id;
HttpServletResponse response = ServletUtils.response();
Cookie cookie = new Cookie("Authorization", token);
cookie.setPath("/");
cookie.setMaxAge(FOR_EVER);
response.addCookie(cookie);
try {
response.sendRedirect(url);
} catch (IOException e) {
LogUtil.error(e.getMessage());
DEException.throwException(e);
}
}
} }

View File

@ -1,18 +1,17 @@
import axios from 'axios' import axios from 'axios'
import store from '@/store' import store from '@/store'
import {$alert, $error} from './message' import { $alert, $error } from './message'
import {getToken, getIdToken} from '@/utils/auth' import { getToken, getIdToken } from '@/utils/auth'
import Config from '@/settings' import Config from '@/settings'
import i18n from '@/lang' import i18n from '@/lang'
import {tryShowLoading, tryHideLoading} from './loading' import { tryShowLoading, tryHideLoading } from './loading'
import {getLinkToken, setLinkToken} from '@/utils/auth' import { getLinkToken, setLinkToken } from '@/utils/auth'
const TokenKey = Config.TokenKey const TokenKey = Config.TokenKey
const RefreshTokenKey = Config.RefreshTokenKey const RefreshTokenKey = Config.RefreshTokenKey
const LinkTokenKey = Config.LinkTokenKey const LinkTokenKey = Config.LinkTokenKey
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const getTimeOut = () => { const getTimeOut = () => {
let time = 10 let time = 10
const url = '/system/requestTimeOut' const url = '/system/requestTimeOut'