This commit is contained in:
chenjianxing 2020-07-22 14:54:31 +08:00
commit 159428b4a4
7 changed files with 25 additions and 8 deletions

View File

@ -14,11 +14,13 @@ import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.DependsOn;
import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.core.env.Environment;
import javax.servlet.DispatcherType; import javax.servlet.DispatcherType;
import javax.servlet.Filter; import javax.servlet.Filter;
@ -27,7 +29,8 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
@Configuration @Configuration
public class ShiroConfig { public class ShiroConfig implements EnvironmentAware {
private Environment env;
@Bean @Bean
public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager sessionManager) { public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager sessionManager) {
@ -115,9 +118,11 @@ public class ShiroConfig {
@Bean @Bean
public SessionManager sessionManager(MemoryConstrainedCacheManager memoryConstrainedCacheManager) { public SessionManager sessionManager(MemoryConstrainedCacheManager memoryConstrainedCacheManager) {
Long sessionTimeout = env.getProperty("session.timeout", Long.class, 1800L); // 默认1800s, 半个小时
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
sessionManager.setSessionIdUrlRewritingEnabled(false); sessionManager.setSessionIdUrlRewritingEnabled(false);
sessionManager.setGlobalSessionTimeout(1800000L); sessionManager.setGlobalSessionTimeout(sessionTimeout * 1000);// 超时时间ms
sessionManager.setDeleteInvalidSessions(true); sessionManager.setDeleteInvalidSessions(true);
sessionManager.setSessionValidationSchedulerEnabled(true); sessionManager.setSessionValidationSchedulerEnabled(true);
SimpleCookie sessionIdCookie = new SimpleCookie(); SimpleCookie sessionIdCookie = new SimpleCookie();
@ -137,4 +142,9 @@ public class ShiroConfig {
ShiroDBRealm shiroDBRealm = (ShiroDBRealm) context.getBean("shiroDBRealm"); ShiroDBRealm shiroDBRealm = (ShiroDBRealm) context.getBean("shiroDBRealm");
((DefaultWebSecurityManager) context.getBean("securityManager")).setRealm(shiroDBRealm); ((DefaultWebSecurityManager) context.getBean("securityManager")).setRealm(shiroDBRealm);
} }
@Override
public void setEnvironment(Environment environment) {
this.env = environment;
}
} }

View File

@ -3,7 +3,7 @@
<el-tabs type="border-card" :stretch="true"> <el-tabs type="border-card" :stretch="true">
<el-tab-pane v-for="item in resource" :key="item.resourceId" :label="item.resourceName" class="logging-content"> <el-tab-pane v-for="item in resource" :key="item.resourceId" :label="item.resourceName" class="logging-content">
<ul class="infinite-list" v-infinite-scroll="load(item.resourceId)" infinite-scroll-disabled="disabled"> <ul class="infinite-list" v-infinite-scroll="load(item.resourceId)" infinite-scroll-disabled="disabled">
<li class="infinite-list-item" v-for="log in logContent" :key="log.id">{{ log.content }}</li> <li class="infinite-list-item" v-for="(log, index) in logContent" :key="index">{{ log.content }}</li>
</ul> </ul>
<el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link> <el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link>
</el-tab-pane> </el-tab-pane>

View File

@ -29,7 +29,8 @@
<span>{{$t('commons.workspace')}}</span> <span>{{$t('commons.workspace')}}</span>
</template> </template>
<el-menu-item index="/setting/member">{{$t('commons.member')}}</el-menu-item> <el-menu-item index="/setting/member">{{$t('commons.member')}}</el-menu-item>
<el-menu-item index="/setting/testcase/report/template">{{$t('test_track.plan_view.report_template')}}</el-menu-item> <el-menu-item index="/setting/testcase/report/template">{{$t('test_track.plan_view.report_template')}}
</el-menu-item>
</el-submenu> </el-submenu>
<el-submenu index="4"> <el-submenu index="4">
@ -38,7 +39,9 @@
<span>{{$t('commons.personal_info')}}</span> <span>{{$t('commons.personal_info')}}</span>
</template> </template>
<el-menu-item index="/setting/personsetting">{{$t('commons.personal_setting')}}</el-menu-item> <el-menu-item index="/setting/personsetting">{{$t('commons.personal_setting')}}</el-menu-item>
<el-menu-item index="/setting/apikeys">API Keys</el-menu-item> <el-menu-item v-permission="['admin', 'org_admin', 'test_manager', 'test_user', 'test_viewer']"
index="/setting/apikeys">API Keys
</el-menu-item>
</el-submenu> </el-submenu>
</el-menu> </el-menu>

View File

@ -32,6 +32,7 @@
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="source" :label="$t('user.source')"/>
<el-table-column :label="$t('commons.operating')"> <el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)"> <ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)">

View File

@ -224,7 +224,8 @@ export default {
email_format_is_incorrect: 'Email format is incorrect', email_format_is_incorrect: 'Email format is incorrect',
delete_confirm: 'Are you sure you want to delete this User?', delete_confirm: 'Are you sure you want to delete this User?',
apikey_delete_confirm: 'Are you sure you want to delete this API Key?', apikey_delete_confirm: 'Are you sure you want to delete this API Key?',
input_id_placeholder: 'Please enter ID (only supports numbers and English letters)' input_id_placeholder: 'Please enter ID (only supports numbers and English letters)',
source: 'Source'
}, },
role: { role: {
please_choose_role: 'Please Choose Role', please_choose_role: 'Please Choose Role',

View File

@ -222,7 +222,8 @@ export default {
email_format_is_incorrect: '邮箱格式不正确', email_format_is_incorrect: '邮箱格式不正确',
delete_confirm: '这个用户确定要删除吗?', delete_confirm: '这个用户确定要删除吗?',
apikey_delete_confirm: '这个 API Key 确定要删除吗?', apikey_delete_confirm: '这个 API Key 确定要删除吗?',
input_id_placeholder: '请输入ID (只支持数字、英文字母)' input_id_placeholder: '请输入ID (只支持数字、英文字母)',
source: '用户来源'
}, },
role: { role: {
please_choose_role: '请选择角色', please_choose_role: '请选择角色',

View File

@ -221,7 +221,8 @@ export default {
email_format_is_incorrect: '郵箱格式不正確', email_format_is_incorrect: '郵箱格式不正確',
delete_confirm: '這個用戶確定要刪除嗎?', delete_confirm: '這個用戶確定要刪除嗎?',
apikey_delete_confirm: '這個 API Key 確定要刪除嗎?', apikey_delete_confirm: '這個 API Key 確定要刪除嗎?',
input_id_placeholder: '請輸入ID (只支持數字、英文字母)' input_id_placeholder: '請輸入ID (只支持數字、英文字母)',
source: '用戶來源'
}, },
role: { role: {
please_choose_role: '請選擇角色', please_choose_role: '請選擇角色',