Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
hrs_app_h5
/
bill
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a1463c7a
authored
Apr 29, 2020
by
cocomilk2012
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
oidc authcode login
parent
c1141741
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
28 deletions
src/router/index.js
src/views/OidcCallback.vue
src/router/index.js
View file @
a1463c7a
...
@@ -23,33 +23,21 @@ const router = new VueRouter({
...
@@ -23,33 +23,21 @@ const router = new VueRouter({
component
:
()
=>
import
(
"@/views/test.vue"
)
component
:
()
=>
import
(
"@/views/test.vue"
)
}
}
],
],
scrollBehavior
(
to
,
from
,
savedPosition
)
{
scrollBehavior
(
to
,
from
,
savedPosition
)
{
return
{
x
:
0
,
y
:
0
}
return
{
x
:
0
,
y
:
0
}
}
}
})
})
//router.beforeEach(vuexOidcCreateRouterMiddleware(store));
//router.beforeEach(vuexOidcCreateRouterMiddleware(store));
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
store
.
dispatch
(
"getOidcUser"
).
then
(
user
=>
{
const
authcode
=
to
.
query
.
authcode
;
if
(
user
)
{
const
params
=
{
to
,
authcode
}
console
.
log
(
'3'
);
store
.
dispatch
(
'oidcCheckAccess'
,
params
).
then
(
function
(
hasAccess
)
{
console
.
log
(
'user='
,
user
);
const
hasToken
=
localStorage
.
getItem
(
"token"
)
?
true
:
false
;
if
(
hasAccess
&&
hasToken
)
{
next
();
next
();
}
}
else
{
console
.
log
(
'4'
);
const
authCode
=
"8f933f0af8d541188a5161218a4650db"
;
//to.query.authcode;
let
args
=
{
options
:
{
extraQueryParams
:
{
authcode
:
authCode
}
}
};
store
.
dispatch
(
'authenticateOidc'
,
args
);
}
}).
catch
(
err
=>
{
console
.
log
(
err
);
const
authCode
=
"8f933f0af8d541188a5161218a4650db"
;
let
args
=
{
options
:
{
extraQueryParams
:
{
authcode
:
authCode
}
}
};
store
.
dispatch
(
'authenticateOidc'
,
args
);
});
});
})
})
...
...
src/views/OidcCallback.vue
View file @
a1463c7a
...
@@ -60,16 +60,17 @@ export default {
...
@@ -60,16 +60,17 @@ export default {
mounted
()
{
mounted
()
{
this
.
oidcSignInCallback
()
this
.
oidcSignInCallback
()
.
then
(
redirectPath
=>
{
.
then
(
redirectPath
=>
{
// this.getOidcUser()
console
.
log
(
2
);
// .then(user => {
this
.
getOidcUser
()
// let urlsearch = redirectPath.split("?")[1];
.
then
(
user
=>
{
// let appid = this.getQueryString(urlsearch, "appid");
let
urlsearch
=
redirectPath
.
split
(
"?"
)[
1
];
// this.getToken(user.access_token, appid, redirectPath);
let
appid
=
this
.
getQueryString
(
urlsearch
,
"appid"
);
// })
this
.
getToken
(
user
.
access_token
,
appid
,
redirectPath
);
// .catch(err => {
})
// console.log("err=", err);
.
catch
(
err
=>
{
// });
console
.
log
(
"err="
,
err
);
this
.
$router
.
push
(
redirectPath
);
});
//this.$router.push(redirectPath);
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
console
.
error
(
err
);
console
.
error
(
err
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment