소스 검색

4.0.46 单点登录增加cas认证

liuyanpeng 2 년 전
부모
커밋
9af655df30

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-base-v4",
   "description": "Leanwo Prodog Client",
-  "version": "4.0.45",
+  "version": "4.0.46",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",

+ 208 - 0
src/client/CasLogin.vue

@@ -0,0 +1,208 @@
+<template>
+  <div class="login">
+    <div class="login_wrapper">
+      <div class="login_form">
+        <h3 style="text-align: center; margin-top: 30px">单点登录</h3>
+
+        <div class="separator" />
+        <div class="selectItem">
+          <label for="">客户端</label>
+          <select
+            v-model="internet"
+            name="language-choice"
+            class="form-control"
+            style="width: 100%"
+          >
+            <option value="pc">电脑端</option>
+            <option value="mobile">移动端</option>
+            <option value="propass">Propass</option>
+          </select>
+        </div>
+        <div class="selectItem">
+          <label>语言</label>
+          <select
+            v-model="languageSelected"
+            name="language-choice"
+            class="form-control"
+            style="width: 100%"
+          >
+            <option value="zh-CN">中文</option>
+            <option value="en-US">English</option>
+          </select>
+        </div>
+        <button
+          class="btn btn-default"
+          style="width: 100%"
+          @click="azureCasLogin"
+        >
+          确认
+        </button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import Common from '../common/Common.js';
+import LoginServicer from './LoginServicer.js';
+
+export default {
+  data: function () {
+    return {
+      internet: 'pc',
+      languageSelected: 'zh-CN',
+    };
+  },
+  mounted() {
+    this.ticket = this.$route.query.ticket;
+    this.redirect_uri = this.$route.query.serviceUrl;
+    this.authSettingNo = this.$route.query.authSettingNo;
+  },
+  methods: {
+    // 单点登录
+    azureCasLogin: function () {
+      let _self = this;
+      const params = {
+        ticket: _self.ticket,
+        redirect_uri: _self.redirect_uri,
+        authSettingNo: _self.authSettingNo,
+        languageId: _self.languageSelected,
+      };
+      $.ajax({
+        url: Common.getApiURL('CasLogin/login'),
+        type: 'post',
+        async: true,
+        data: params,
+        success: function (loginInfoData) {
+          if (loginInfoData.errorCode == 0) {
+            // _self.setTokenClient();
+            LoginServicer.setLoginInfo(loginInfoData.data);
+            if (_self.internet === 'pc') {
+              localStorage.setItem('allowSound', false);
+              window.location.href =
+                Common.getRootPath() + '/#/desktop/dashboard';
+            } else if (_self.internet === 'mobile') {
+              window.location.href =
+                Common.getRootPath() + '/app.html#/desktop/moduleSelect';
+            } else {
+              window.location.href =
+                Common.getRootPath() + '/propass.html#/propassapp/menu';
+            }
+          } else {
+            Notify.error(
+              _self.$t('lang.login.loginFailure'),
+              loginInfoData.errorMessage,
+            );
+          }
+        },
+        error: function (XMLHttpRequest, textStatus, errorThrown) {
+          Common.processException(XMLHttpRequest, textStatus, errorThrown);
+        },
+      });
+    },
+
+    //设置 TokenClient
+    setTokenClient: function () {
+      $.ajax({
+        url: Common.getApiURL('TokenClientResource/saveTokenClient'),
+        type: 'post',
+        dataType: 'json',
+        contentType: 'application/json',
+        beforeSend: function (request) {
+          request.setRequestHeader('token', localStorage.getItem('#token'));
+          request.setRequestHeader(
+            'account',
+            localStorage.getItem('#accountId'),
+          );
+        },
+        success: function (baseObjectResponse) {
+          console.log(baseObjectResponse, 'token添加成功');
+        },
+        error: function (XMLHttpRequest, textStatus, errorThrown) {
+          Common.processException(XMLHttpRequest, textStatus, errorThrown);
+        },
+      });
+    },
+  },
+};
+</script>
+
+<style scoped>
+.login_wrapper {
+  margin: 0px auto;
+  padding-top: 5%;
+  max-width: 350px;
+  position: relative;
+}
+
+.login_form {
+  top: 0px;
+  width: 100%;
+}
+
+#login_box {
+  width: 40%;
+  height: 400px;
+  margin: auto;
+  margin-top: 4%;
+  text-align: center;
+  border-radius: 10px;
+  padding: 50px 50px;
+  border: 1px solid #dddddd;
+}
+
+h2 {
+  margin-top: 5%;
+}
+.selectItem {
+  display: flex;
+  align-items: center;
+  margin: 16px 0 16px 0;
+}
+.selectItem > label {
+  width: 100px;
+  text-align: left;
+  font-size: 15px !important;
+  color: rgba(0, 0, 0, 0.6);
+}
+.confirmBtn {
+  margin-top: 50px;
+  width: 60%;
+  height: 30px;
+  border-radius: 6px;
+  border: 1px solid #e6e6e6;
+  text-align: center;
+  line-height: 30px;
+  font-size: 15px;
+  color: #333;
+  background-color: #f7f7f7;
+  text-decoration: none;
+  font-weight: 400;
+  user-select: none;
+}
+.confirmBtn:hover {
+  background-color: #eaeaea;
+  border-color: #adadad;
+  background-position: 0 -15px;
+}
+.form-control {
+  width: 74%;
+  display: block;
+  width: 75%;
+  height: 34px;
+  padding: 6px 12px;
+  font-size: 14px;
+  line-height: 1.42857143;
+  color: #555555;
+  background-color: #fff;
+  background-image: none;
+  border: 1px solid #ccc;
+  border-radius: 4px;
+}
+
+.separator {
+  border-top: 1px solid #d8d8d8;
+  margin-top: 10px;
+  padding-top: 10px;
+}
+</style>

+ 39 - 20
src/client/Login.vue

@@ -190,7 +190,7 @@
                         :key="item.id"
                         v-tooltip.top="`${item.authType}-${item.name}`"
                         class="login-third-item"
-                        @click="existsSAML(item.no)"
+                        @click="existsServer(item)"
                       >
                         <img :src="getImageSrc(item.className, item.logo)" />
                       </span>
@@ -299,24 +299,11 @@ export default {
   methods: {
     initView: function () {
       var _self = this;
-      const languageSelected = localStorage.getItem('#languageSelected');
-      const rememberPassword = localStorage.getItem('#rememberPassword');
-      if (!languageSelected) {
-        localStorage.removeItem('#languageSelected');
-      } else {
-        _self.languageSelected = localStorage.getItem('#languageSelected');
-      }
-      if (rememberPassword === 'true') {
-        _self.rememberPassword = true;
-        _self.userName = localStorage.getItem('#userName');
-        _self.password = localStorage.getItem('#password');
-      } else {
-        _self.userName = null;
-        _self.password = null;
-        _self.rememberPassword = false;
-        localStorage.removeItem('#userName');
-        localStorage.removeItem('#password');
-      }
+      const storageInfo = LoginService.restoreFromLocalStorage();
+      _self.userName = storageInfo.userName;
+      _self.password = storageInfo.password;
+      _self.rememberPassword = storageInfo.rememberPassword;
+      _self.languageSelected = storageInfo.languageSelected;
     },
 
     // 查询单点登录认证源信息
@@ -361,6 +348,16 @@ export default {
         },
       });
     },
+
+    // 判断是哪种单点登录方式
+    existsServer: function (item) {
+      if (item.authType === 'SAML') {
+        this.existsSAML(item.no);
+      } else if (item.authType === 'CAS') {
+        this.existsCAS(item.no);
+      }
+    },
+
     // 判断SAML服务器是否存在
     existsSAML: function (no) {
       $.ajax({
@@ -383,6 +380,29 @@ export default {
         },
       });
     },
+    // 判断CAS服务器是否存在
+    existsCAS: function (no) {
+      $.ajax({
+        url: Common.getApiURL(
+          'CasLogin/casServiceProviderCheck?authSettingNo=' + no,
+        ),
+        type: 'get',
+        contentType: 'application/json',
+        dataType: 'json',
+        success: function (response) {
+          if (response.errorCode === 0) {
+            let url = `/casLogin.html?authSettingNo=${no}`;
+            window.location.href = url;
+            console.log(response);
+          } else {
+            Notify.error('错误', response.errorMessage);
+          }
+        },
+        error: function (XMLHttpRequest, textStatus, errorThrown) {
+          Common.processException(XMLHttpRequest, textStatus, errorThrown);
+        },
+      });
+    },
 
     /**
      * 发送验证码
@@ -493,7 +513,6 @@ export default {
             LoginService.saveLocalStorage(_self);
             _self.setTokenClient();
             localStorage.setItem('allowSound', false);
-            localStorage.setItem('#languageSelected', _self.languageSelected);
           } else {
             Notify.error(
               _self.$t('lang.login.loginFailure'),

+ 47 - 0
src/client/LoginServicer.js

@@ -0,0 +1,47 @@
+export default {
+
+  setLoginInfo: function (loginInfo) {
+    var _self = this;
+
+    _self.clearLocalStorage();
+
+    _self.setLocalStorage(loginInfo);
+
+  },
+
+
+  //  设置localStorage
+  setLocalStorage: function (loginInfo) {
+    localStorage.setItem('#LoginInfo', JSON.stringify(loginInfo));
+    localStorage.setItem('#token', loginInfo.token);
+    localStorage.setItem('#accountId', loginInfo.accountId);
+  },
+
+  clearLocalStorage: function () {
+    // 清理localStorage时需要保留的参数列表
+    var reserveParams = ['hostPageBaseURL', 'workShopId', 'resourceInstanceId',
+      'resourceInstanceName', 'apsBaseUrl', 'cameraBaseURL', '#rememberPassword', '#userName', '#password', '#languageSelected'];
+    //存放的信息
+    var reserveParamValues = [];
+
+    //获取参数信息 
+    var len = reserveParams.length;
+    for (let i = 0; i < len; i++) {
+      var reserveParam = reserveParams[i];
+      var reserveParamValue = '';
+      if (localStorage.getItem(reserveParam) != undefined) {
+        reserveParamValue = localStorage.getItem(reserveParam);
+      }
+      reserveParamValues.push(reserveParamValue);
+    }
+
+    //清理localStorage
+    window.localStorage.clear();
+
+    //还原参数信息
+    for (let i = 0; i < len; i++) {
+      localStorage.setItem(reserveParams[i], reserveParamValues[i]);
+    }
+  },
+
+};

+ 24 - 74
src/client/SamlLogin.vue

@@ -2,12 +2,17 @@
   <div class="login">
     <div class="login_wrapper">
       <div class="login_form">
-        <h3 style="text-align: center;margin-top: 30px">单点登录</h3>
-        
+        <h3 style="text-align: center; margin-top: 30px">单点登录</h3>
+
         <div class="separator" />
         <div class="selectItem">
           <label for="">客户端</label>
-          <select v-model="internet" name="language-choice" class="form-control" style="width:100%">
+          <select
+            v-model="internet"
+            name="language-choice"
+            class="form-control"
+            style="width: 100%"
+          >
             <option value="pc">电脑端</option>
             <option value="mobile">移动端</option>
             <option value="propass">Propass</option>
@@ -19,13 +24,19 @@
             v-model="languageSelected"
             name="language-choice"
             class="form-control"
-            style="width:100%"
+            style="width: 100%"
           >
             <option value="zh-CN">中文</option>
             <option value="en-US">English</option>
           </select>
         </div>
-        <button class="btn btn-default" style="width: 100%;" @click="azureSamlLogin">确认</button>
+        <button
+          class="btn btn-default"
+          style="width: 100%"
+          @click="azureSamlLogin"
+        >
+          确认
+        </button>
       </div>
     </div>
   </div>
@@ -33,7 +44,7 @@
 
 <script>
 import Common from '../common/Common.js';
-import LoginService from './LoginService.js';
+import LoginServicer from './LoginServicer.js';
 
 export default {
   data: function () {
@@ -56,30 +67,16 @@ export default {
         data: params,
         success: function (loginInfoData) {
           if (loginInfoData.errorCode == 0) {
+            _self.setTokenClient();
+            LoginServicer.setLoginInfo(loginInfoData.data);
             if (_self.internet === 'pc') {
-              LoginService.setLoginInfo(loginInfoData.data, _self.$router);
-              LoginService.saveLocalStorage(_self);
-              _self.setTokenClient(loginInfoData.data.token);
               localStorage.setItem('allowSound', false);
               window.location.href =
                 Common.getRootPath() + '/#/desktop/dashboard';
             } else if (_self.internet === 'mobile') {
-              var loginInfo = loginInfoData.data;
-              Common.clearLocalStorage();
-              Common.clearAppCookie(loginInfo);
-              _self.setAppLocalStorage(loginInfo);
-              _self.setTokenClient();
               window.location.href =
                 Common.getRootPath() + '/app.html#/desktop/moduleSelect';
             } else {
-              Common.clearLocalStorage();
-              $.removeCookie('token', { path: '/' });
-              $.removeCookie('token', { path: '/pcapp' });
-              $.cookie('token', loginInfoData.data.token, {
-                expires: 7,
-                path: '/',
-              });
-              _self.setPropassLocalStorage(loginInfoData);
               window.location.href =
                 Common.getRootPath() + '/propass.html#/propassapp/menu';
             }
@@ -96,61 +93,19 @@ export default {
       });
     },
 
-    // 设置 App localStorage
-    setAppLocalStorage: function (loginInfo) {
-      const _self = this;
-      if (!window.localStorage) {
-        Notify.error('错误', '浏览器不支持localstorage', false);
-      } else {
-        const storage = window.localStorage;
-        const loginInfo1 = JSON.stringify(loginInfo);
-        storage.setItem('#loginInfo', loginInfo1);
-        storage.setItem('account', loginInfo.accountId);
-        storage.setItem('token', loginInfo.token);
-        storage.setItem('rememberPassword', false);
-        localStorage.setItem('#languageSelected', _self.languageSelected);
-      }
-    },
-    //  设置 Propass localStorage
-    setPropassLocalStorage: function (loginInfo) {
-      const _self = this;
-
-      const loginInfoStr = JSON.stringify(loginInfo);
-      localStorage.setItem('json_LoginInfo', loginInfoStr);
-      localStorage.setItem('#token', loginInfo.data.token);
-      localStorage.setItem('#accountId', loginInfo.data.accountId);
-      localStorage.setItem('#languageSelected', _self.languageSelected);
-      localStorage.setItem('rememberPassword', false);
-    },
     //设置 TokenClient
     setTokenClient: function () {
-      const _self = this;
       $.ajax({
         url: Common.getApiURL('TokenClientResource/saveTokenClient'),
         type: 'post',
         dataType: 'json',
         contentType: 'application/json',
         beforeSend: function (request) {
-          if (_self.internet === 'pc') {
-            request.setRequestHeader('token', localStorage.getItem('#token'));
-          } else {
-            let token = $.cookie('token');
-            let account = $.cookie('account');
-            if (token == undefined) {
-              const localStorageToken = localStorage.getItem('token');
-              if (localStorageToken != undefined) {
-                token = localStorageToken;
-              }
-            }
-            if (account == undefined) {
-              const localStorageAccount = localStorage.getItem('account');
-              if (localStorageAccount != undefined) {
-                account = localStorageAccount;
-              }
-            }
-            request.setRequestHeader('account', account);
-            request.setRequestHeader('token', token);
-          }
+          request.setRequestHeader('token', localStorage.getItem('#token'));
+          request.setRequestHeader(
+            'account',
+            localStorage.getItem('#accountId'),
+          );
         },
         success: function (baseObjectResponse) {
           console.log(baseObjectResponse, 'token添加成功');
@@ -165,8 +120,6 @@ export default {
 </script>
 
 <style scoped>
-
-
 .login_wrapper {
   margin: 0px auto;
   padding-top: 5%;
@@ -179,8 +132,6 @@ export default {
   width: 100%;
 }
 
-
-
 #login_box {
   width: 40%;
   height: 400px;
@@ -241,7 +192,6 @@ h2 {
   border-radius: 4px;
 }
 
-
 .separator {
   border-top: 1px solid #d8d8d8;
   margin-top: 10px;

+ 2 - 2
src/common/pushMessage.js

@@ -164,7 +164,7 @@ export default {
         },
         onClick: () => {
           notification.close(messageData.uuid);
-          _self.replyMessage(messageData.content.id);
+          // _self.replyMessage(messageData.content.id);
           TaskOpenUtil.openTask(messageData.content).then(
             successData => {
               if (successData.type === 'newWindow') {
@@ -191,7 +191,7 @@ export default {
         duration: 5,
         onClick: () => {
           notification.close(messageData.uuid);
-          _self.replyDocument(messageData.content.id);
+          // _self.replyDocument(messageData.content.id);
           TaskOpenUtil.openCopyTask(messageData.content).then(
             successData => {
               if (successData.type === 'newWindow') {

+ 119 - 0
src/identity/CasAccountSetting.vue

@@ -0,0 +1,119 @@
+<template>
+  <div class="proDog-setting">
+    <a-form
+      ref="formRef"
+      name="basic"
+      :label-col="{ style: { width: '140px' } }"
+      :wrapper-col="{ span: 8 }"
+      :model="identitySetting"
+      autocomplete="off"
+    >
+      <h4>字段配置</h4>
+      <a-divider />
+      <a-form-item label="no(用户编号)" name="userNo">
+        <a-input
+          v-model:value="identitySetting.userNo"
+          placeholder="选填,默认读取 user 字段"
+        />
+      </a-form-item>
+    </a-form>
+    <div style="margin: 22px 0 -22px 0">
+      <a-button @click="prev"> 上一步 </a-button>
+      <a-button type="primary" style="margin-left: 8px" @click="createIdentity">
+        完成
+      </a-button>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import Common from '../common/Common';
+import { useRouter } from 'vue-router';
+import { message } from 'ant-design-vue';
+import { saveUpdateAuth } from './configData.js';
+import { ref, defineProps, defineEmits, onMounted } from 'vue';
+
+const router = useRouter();
+const emit = defineEmits(['getDatas']);
+const props = defineProps({
+  formData: {
+    type: Object,
+    default: () => ({}),
+  },
+  identityInfo: {
+    type: Object,
+    default: () => ({}),
+  },
+});
+const formRef = ref();
+const prevDatas = ref({});
+const identitySetting = ref({});
+
+onMounted(() => {
+  prevDatas.value = props.identityInfo;
+  identitySetting.value = props.formData;
+});
+
+// 新建或更新认证源
+const createIdentity = () => {
+  formRef.value.validate().then(success => {
+    const jsonStr = JSON.stringify(identitySetting.value);
+    const formData = new FormData();
+    formData.append('attribute', jsonStr);
+    formData.append('id', prevDatas.value.id);
+    formData.append('name', prevDatas.value.name);
+    formData.append('no', prevDatas.value.no);
+    formData.append('logo', prevDatas.value.file);
+    formData.append('active', prevDatas.value.active);
+    formData.append('authType', prevDatas.value.authType);
+    formData.append('description', prevDatas.value.description);
+    saveUpdateAuth(formData).then(
+      success => {
+        if (success.errorCode === 0) {
+          if (!prevDatas.value.id) {
+            message.success('新建认证源成功!');
+          } else {
+            message.success('更新认证源成功!');
+          }
+          router.push('/desktop/identityManager');
+        } else {
+          message.error(success.errorMessage);
+        }
+      },
+      error => {
+        Common.processException(error);
+      },
+    );
+  });
+};
+
+const prev = () => {
+  const datas = {
+    current: 2,
+    formData: identitySetting.value,
+  };
+  emit('getDatas', datas);
+};
+
+</script>
+
+<style scoped>
+.proDog-setting > h3 {
+  font-size: 14px !important;
+  font-weight: 700;
+}
+:deep(.ant-form-item-control-input-content) {
+  display: flex;
+  align-items: center;
+}
+:deep(.ant-form-item-label > label) {
+  font-size: 12px !important;
+  color: rgba(0, 0, 0, 0.4);
+}
+.ant-form-item {
+  margin-bottom: 4px;
+}
+.ant-divider-horizontal {
+  margin: 0 0 5px 0 !important;
+}
+</style>

+ 102 - 0
src/identity/CasConfiguration.vue

@@ -0,0 +1,102 @@
+<template>
+  <a-form
+    ref="formRef"
+    name="basic"
+    :label-col="{ style: { width: '140px' } }"
+    :wrapper-col="{ span: 8 }"
+    :model="identitySetting"
+    autocomplete="off"
+    :rules="rulesForStep"
+  >
+    <a-form-item has-feedback label="CAS 认证URL" name="casUrl">
+      <a-input
+        v-model:value="identitySetting.casUrl"
+        placeholder="必填,请输入CAS 认证URL"
+      />
+    </a-form-item>
+    <a-form-item has-feedback label="CAS Ticket校验URL" name="casTicketUrl">
+      <a-input
+        v-model:value="identitySetting.casTicketUrl"
+        placeholder="必填,请输入CAS Ticket校验URL"
+      />
+    </a-form-item>
+    <a-form-item has-feedback label="CAS 退出登录URL" name="casLogoutUrl">
+      <a-input
+        v-model:value="identitySetting.casLogoutUrl"
+        placeholder="选填,请输入CAS 退出登录URL"
+      />
+    </a-form-item>
+  </a-form>
+  <div style="margin: 22px 0 -22px 0">
+    <a-button @click="prev"> 上一步 </a-button>
+    <a-button type="primary" style="margin-left: 8px" @click="next">
+      下一步
+    </a-button>
+  </div>
+</template>
+
+<script setup>
+import { ref, defineProps, defineEmits, onMounted } from 'vue';
+
+const emit = defineEmits(['getDatas']);
+const props = defineProps({
+  formData: {
+    type: Object,
+    default: () => ({}),
+  },
+});
+
+const formRef = ref();
+// 表单数据
+const identitySetting = ref({});
+const rulesForStep = {
+  casUrl: [
+    {
+      required: true,
+      message: '请输入CAS 认证URL!',
+      trigger: 'change',
+    },
+  ],
+  casTicketUrl: [
+    {
+      required: true,
+      message: '请输入CAS Ticket校验URL!',
+      trigger: 'change',
+    },
+  ],
+};
+onMounted(() => {
+  identitySetting.value = props.formData;
+});
+
+const prev = () => {
+  const datas = {
+    current: 1,
+    formData: identitySetting.value,
+  };
+  emit('getDatas', datas);
+};
+const next = () => {
+  const datas = {
+    current: 3,
+    formData: identitySetting.value,
+  };
+  formRef.value.validate().then(success => {
+    emit('getDatas', datas);
+  });
+};
+</script>
+
+<style scoped>
+:deep(.ant-form-item-control-input-content) {
+  display: flex;
+  align-items: center;
+}
+:deep(.ant-form-item-label > label) {
+  font-size: 12px !important;
+  color: rgba(0, 0, 0, 0.4);
+}
+.ant-form-item {
+  margin-bottom: 4px;
+}
+</style>

+ 44 - 10
src/identity/CreateIdentity.vue

@@ -94,13 +94,26 @@
         </a-form>
       </div>
       <div v-else-if="steps[current].contentTemplate === 'Third'">
+        <CasConfiguration
+          v-if="activeIndex === 2"
+          :form-data="casSetting"
+          @get-datas="getDatas"
+        />
         <BasicConfiguration
+          v-else
           :form-data="identitySetting"
           @get-datas="getDatas"
         />
       </div>
       <div v-else>
+        <CasAccountSetting
+          v-if="activeIndex === 2"
+          :form-data="casSetting"
+          :identity-info="identityInfo"
+          @get-datas="getDatas"
+        />
         <AccountAssociation
+          v-else
           :form-data="identitySetting"
           :identity-info="identityInfo"
           @get-datas="getDatas"
@@ -122,7 +135,6 @@
         v-if="current === 1"
         type="primary"
         style="margin-left: 8px"
-        
         @click="next"
       >
         下一步
@@ -139,6 +151,8 @@ import { ref, reactive, onMounted } from 'vue';
 import { getImageSrc } from '../common/image-src';
 import BasicConfiguration from './BasicConfiguration.vue';
 import AccountAssociation from './AccountAssociation.vue';
+import CasConfiguration from './CasConfiguration.vue';
+import CasAccountSetting from './CasAccountSetting.vue';
 import {
   getBase64,
   imageToBase64,
@@ -147,7 +161,6 @@ import {
   isNoExist,
 } from './configData.js';
 
-
 const formRef2 = ref();
 const route = useRoute();
 const current = ref(0); // 当前步骤
@@ -187,10 +200,20 @@ const identitySetting = ref({
   spAssertionConsumeSuccessRedirectService:
     'http://xxxx:xx/index.html#/samlLogin',
 });
+const casSetting = ref({
+  userNo: '',
+  casUrl: 'https://cas.example.com/cas/login',
+  casTicketUrl: 'https://cas.example.com/cas/serviceValidate',
+  casLogoutUrl: 'https://cas.example.com/cas/logout',
+});
 
 const getDatas = datas => {
   current.value = datas.current;
-  identitySetting.value = datas.formData;
+  if (activeIndex.value === 2) {
+    casSetting.value = datas.formData;
+  } else {
+    identitySetting.value = datas.formData;
+  }
 };
 
 // 获取更新Id
@@ -231,13 +254,18 @@ const queryAuthById = id => {
         logoClassName.value = className;
         identityInfo.description = description;
         const datas = JSON.parse(attribute);
-        identitySetting.value = datas;
         if (authType === 'OAuth2.0') {
           activeIndex.value = 0;
           identityInfo.authType = 'OAUTH';
-        } else {
+          identitySetting.value = datas;
+        } else if (authType === 'SAML') {
           activeIndex.value = 1;
           identityInfo.authType = 'SAML';
+          identitySetting.value = datas;
+        } else {
+          activeIndex.value = 2;
+          identityInfo.authType = 'CAS';
+          casSetting.value = datas;
         }
       } else {
         message.error(success.errorMessage);
@@ -258,12 +286,11 @@ const validateIsNoExist = (no, excludeId) => {
     isNoExist(params).then(
       success => {
         if (success.errorCode === 0) {
-          if(success.data === false){
+          if (success.data === false) {
             resolve();
-          }else{
+          } else {
             reject('认证源标识已经存在');
           }
-          
         } else {
           reject(success.errorMessage);
         }
@@ -384,6 +411,11 @@ const selectedItem = ref([
     imgSrc: '/static/assets/client-base-v4/image/saml.png',
     tooltip: 'SAML是安全断言标记语言,是一个基于XML的开源标准数据格式。',
   },
+  {
+    title: 'CAS',
+    imgSrc: '/static/assets/client-base-v4/image/cas.png',
+    tooltip: 'SAML是一种用于web单点登录,主要依赖于统一的认证方式和票据验证。',
+  },
 ]);
 
 // 下一步
@@ -393,7 +425,7 @@ const next = () => {
     formRef2.value.validate().then(success => {
       current.value++;
     });
-  }else{
+  } else {
     current.value++;
   }
 };
@@ -409,8 +441,10 @@ const setActiveItem = index => {
   activeIndex.value = index;
   if (index === 0) {
     identityInfo.authType = 'OAUTH';
-  } else {
+  } else if (index === 1) {
     identityInfo.authType = 'SAML';
+  } else {
+    identityInfo.authType = 'CAS';
   }
 };
 </script>

+ 2 - 0
src/index.js

@@ -74,6 +74,7 @@ import ArchivalRecord from '../src/archive/ArchivalRecord.vue';
 import IdentityManager  from '../src/identity/IdentityManager.vue';
 import CreateIdentity  from '../src/identity/CreateIdentity.vue';
 import SamlLogin  from './client/SamlLogin.vue';
+import CasLogin  from './client/CasLogin.vue';
 import PrinterConfiguration from '../src/printer/PrinterConfiguration.vue';
 
 export {
@@ -85,6 +86,7 @@ export {
   PushMessage,
   Login,
   SamlLogin,
+  CasLogin,
   Desktop,
   Dashboard,
   Window,

+ 8 - 0
src/routes/main_routes.js

@@ -64,6 +64,7 @@ const ExcelImport = () => import('../customer/ExcelImport.vue');
 const IdentityManager = () => import('../identity/IdentityManager.vue');
 const CreateIdentity = () => import('../identity/CreateIdentity.vue');
 const SamlLogin = () => import('../client/SamlLogin.vue');
+const CasLogin = () => import('../client/CasLogin.vue');
 const PrinterConfiguration = () => import('../printer/PrinterConfiguration.vue');
 
 import { ProcessReport } from 'pc-component-v3';
@@ -84,6 +85,13 @@ export default [
       loginRequired: false,
     },
   },
+  {
+    path: '/casLogin',
+    component: CasLogin,
+    meta: {
+      loginRequired: false,
+    },
+  },
   {
     path: '/desktop', component: Desktop,
     children: [