Commit e2fa5332 by 张建朝

tj

parent 64c35a12
VUE_APP_OIDC_CONFIG = '{ "authority": "http://192.168.1.156:5000", "client_id": "teamix-team-manager-web-mobile", "client_secret": "123456", "redirect_uri": "http://10.10.11.31:8080/callback.html", "response_type": "id_token token", "scope": "workapps.client api.workapps.user api.workapps.org api.workapps.open openid","post_logout_redirect_uri":"http://10.10.11.31:8080", "silent_redirect_uri": "http://10.10.11.31:8080/silentrenew.html", "automaticSilentRenew": true,"accessTokenExpiringNotificationTime":60,"filterProtocolClaims":true,"loadUserInfo":true }'
VUE_APP_OIDC_CONFIG = '{ "authority": "http://106.120.107.150:5000", "client_id": "teamix-team-manager-web-pc", "client_secret": "123456", "redirect_uri": "http://localhost:8080/oidc-callback", "response_type": "id_token token", "scope": "workapps.client api.workapps.user api.workapps.org api.workapps.open openid","post_logout_redirect_uri":"http://localhost:8080", "silent_redirect_uri": "http://localhost:8080/silentrenew.html", "automaticSilentRenew": true,"accessTokenExpiringNotificationTime":60,"filterProtocolClaims":true,"loadUserInfo":true }'
VUE_APP_ORG_API_BASEURL = 'http://192.168.1.161:7771'
#VUE_APP_ORG_API_BASEURL = 'http://10.10.11.31:63766'
......
......@@ -2208,8 +2208,7 @@
"base64-js": {
"version": "1.3.1",
"resolved": "https://registry.npm.taobao.org/base64-js/download/base64-js-1.3.1.tgz",
"integrity": "sha1-WOzoy3XdB+ce0IxzarxfrE2/jfE=",
"dev": true
"integrity": "sha1-WOzoy3XdB+ce0IxzarxfrE2/jfE="
},
"batch": {
"version": "0.6.1",
......@@ -3537,6 +3536,11 @@
"randomfill": "^1.0.3"
}
},
"crypto-js": {
"version": "3.3.0",
"resolved": "https://registry.npm.taobao.org/crypto-js/download/crypto-js-3.3.0.tgz",
"integrity": "sha1-hG3RzOL2iqz6FWyFePkmpgm3l2s="
},
"css": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz",
......@@ -7567,6 +7571,24 @@
"integrity": "sha1-Cb6jND1BhZ69RGKS0RydTbYZCE4=",
"dev": true
},
"oidc-client": {
"version": "1.10.1",
"resolved": "https://registry.npm.taobao.org/oidc-client/download/oidc-client-1.10.1.tgz",
"integrity": "sha1-/meuVJJPwcM4Bi8/1zO+NiAmGSw=",
"requires": {
"base64-js": "^1.3.0",
"core-js": "^2.6.4",
"crypto-js": "^3.1.9-1",
"uuid": "^3.3.2"
},
"dependencies": {
"core-js": {
"version": "2.6.11",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.11.tgz",
"integrity": "sha1-OIMUafmSK97Y7iHJ3EaYXgOZMIw="
}
}
},
"on-finished": {
"version": "2.3.0",
"resolved": "http://registry.npm.taobao.org/on-finished/download/on-finished-2.3.0.tgz",
......@@ -10754,8 +10776,7 @@
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npm.taobao.org/uuid/download/uuid-3.4.0.tgz?cache=0&sync_timestamp=1585683716423&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuuid%2Fdownload%2Fuuid-3.4.0.tgz",
"integrity": "sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=",
"dev": true
"integrity": "sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4="
},
"validate-npm-package-license": {
"version": "3.0.4",
......@@ -10888,6 +10909,11 @@
"resolved": "https://registry.npm.taobao.org/vuex/download/vuex-3.1.3.tgz",
"integrity": "sha1-8q1z4/tzaRaYs4yT9m5Y4meUcYA="
},
"vuex-oidc": {
"version": "3.4.3",
"resolved": "https://registry.npm.taobao.org/vuex-oidc/download/vuex-oidc-3.4.3.tgz",
"integrity": "sha1-igQBqwC1uBFTDXVazzX/J057UAk="
},
"watchpack": {
"version": "1.6.1",
"resolved": "https://registry.npm.taobao.org/watchpack/download/watchpack-1.6.1.tgz?cache=0&sync_timestamp=1585253929080&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwatchpack%2Fdownload%2Fwatchpack-1.6.1.tgz",
......
......@@ -10,11 +10,13 @@
"axios": "^0.19.2",
"core-js": "^3.6.4",
"lib-flexible": "^0.3.2",
"oidc-client": "^1.10.1",
"postcss-px2rem": "^0.3.0",
"vant": "^2.6.0",
"vue": "^2.6.11",
"vue-router": "^3.1.6",
"vuex": "^3.1.3"
"vuex": "^3.1.3",
"vuex-oidc": "^3.4.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.3.0",
......
......@@ -2,6 +2,8 @@ import Vue from 'vue'
import VueRouter from 'vue-router'
import moreRouters from './more-router.js'
import billRouters from './bill-router.js'
import { vuexOidcCreateRouterMiddleware } from 'vuex-oidc'
import store from '../store'
Vue.use(VueRouter)
......@@ -11,10 +13,17 @@ const router = new VueRouter({
routes:[
...billRouters,
...moreRouters,
{
path: '/callback.html',
name: "oidcCallback",
component: () => import("@/views/OidcCallback.vue")
}
],
scrollBehavior(to, from, savedPosition) {
return { x: 0, y: 0 }
}
})
router.beforeEach(vuexOidcCreateRouterMiddleware(store))
export default router
import Vue from 'vue'
import Vuex from 'vuex'
import token from "./modules/token";
import { vuexOidcCreateStoreModule } from 'vuex-oidc';
import oidcSettings from "../utils/oidcSettings";
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
token
token,
oidc: vuexOidcCreateStoreModule(oidcSettings)
}
});
// import Oidc,{ UserManager } from "oidc-client";
// Oidc.Log.logger= console;
//Oidc.Log.level = 'INFO';
export default class common {
getQueryString(name) {
......@@ -7,4 +10,24 @@ export default class common {
if (r != null) return unescape(r[2]);
return null;
}
// getUserManager(){
// //var settings = new OidcClientSettings();
// var oidcSettings = JSON.parse(process.env.VUE_APP_OIDC_CONFIG);
// var userManager = new UserManager({
// authority: oidcSettings.authority,
// client_id: oidcSettings.client_id,
// client_secret: oidcSettings.client_secret,
// redirect_uri: oidcSettings.redirect_uri,
// response_type: oidcSettings.response_type,
// scope: oidcSettings.scope,
// silent_redirect_uri: oidcSettings.silent_redirect_uri,
// automaticSilentRenew: oidcSettings.automaticSilentRenew,
// accessTokenExpiringNotificationTime: oidcSettings.accessTokenExpiringNotificationTime,
// filterProtocolClaims: oidcSettings.filterProtocolClaims,
// loadUserInfo: oidcSettings.loadUserInfo
// });
// return userManager;
// }
}
\ No newline at end of file
var oidcSettings = JSON.parse( process.env.VUE_APP_OIDC_CONFIG)
export default {
authority: oidcSettings.authority,
client_id: oidcSettings.client_id,
client_secret: oidcSettings.client_secret,
redirect_uri: oidcSettings.redirect_uri,
response_type: oidcSettings.response_type,
scope: oidcSettings.scope,
silent_redirect_uri: oidcSettings.silent_redirect_uri,
automaticSilentRenew: oidcSettings.automaticSilentRenew,
accessTokenExpiringNotificationTime: oidcSettings.accessTokenExpiringNotificationTime,
filterProtocolClaims: oidcSettings.filterProtocolClaims,
loadUserInfo: oidcSettings.loadUserInfo
}
\ No newline at end of file
......@@ -143,6 +143,7 @@
<script>
import { Icon } from "vant";
import { TabHeader } from "@/components";
import * as utils from "../../utils/common";
export default {
components: {
[Icon.name]: Icon,
......
<template>
<div>
</div>
</template>
<script>
import { mapActions } from 'vuex'
export default {
name: 'OidcCallback',
methods: {
...mapActions([
'oidcSignInCallback'
])
},
mounted () {
this.oidcSignInCallback()
.then((redirectPath) => {
this.$router.push(redirectPath)
})
.catch((err) => {
console.error(err)
this.$router.push('/oidc-callback-error') // Handle errors any way you want
})
}
}
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment