Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
dashboard
Commits
aa220d26
Commit
aa220d26
authored
Apr 05, 2018
by
Andrea Ida Malkah Klaura
Browse files
added oidc access token renewal with debug code
parent
c75a659a
Changes
6
Show whitespace changes
Inline
Side-by-side
config/dev.env.js
View file @
aa220d26
...
@@ -4,6 +4,7 @@ const prodEnv = require('./prod.env')
...
@@ -4,6 +4,7 @@ const prodEnv = require('./prod.env')
module
.
exports
=
merge
(
prodEnv
,
{
module
.
exports
=
merge
(
prodEnv
,
{
NODE_ENV
:
'
"development"
'
,
NODE_ENV
:
'
"development"
'
,
OIDC_CLIENT_ID
:
'
"174626"
'
,
API_STEERING
:
'
"http://127.0.0.1:8000/api/v1/"
'
,
API_STEERING
:
'
"http://127.0.0.1:8000/api/v1/"
'
,
API_STEERING_SHOWS
:
'
"http://127.0.0.1:8000/api/v1/shows/"
'
,
API_STEERING_SHOWS
:
'
"http://127.0.0.1:8000/api/v1/shows/"
'
,
// OIDC endpoint of the pv/steering module
// OIDC endpoint of the pv/steering module
...
...
src/App.vue
View file @
aa220d26
...
@@ -38,19 +38,23 @@ export default {
...
@@ -38,19 +38,23 @@ export default {
name
:
''
,
name
:
''
,
email
:
''
,
email
:
''
,
access_token
:
''
,
access_token
:
''
,
expires_at
:
0
,
logged_in
:
false
logged_in
:
false
},
},
userOIDC
:
null
,
userOIDC
:
null
,
mgr
:
new
oidc
.
UserManager
({
mgr
:
new
oidc
.
UserManager
({
userStore
:
new
oidc
.
WebStorageStateStore
(),
userStore
:
new
oidc
.
WebStorageStateStore
(),
authority
:
process
.
env
.
API_STEERING_OIDC_URI
,
authority
:
process
.
env
.
API_STEERING_OIDC_URI
,
client_id
:
'
174626
'
,
// the client id has to be a string, therefore we add the + ''
client_id
:
process
.
env
.
OIDC_CLIENT_ID
,
redirect_uri
:
process
.
env
.
API_STEERING_OIDC_REDIRECT_URI
,
redirect_uri
:
process
.
env
.
API_STEERING_OIDC_REDIRECT_URI
,
// redirect_uri: process.env.API_STEERING_OIDC_REDIRECT_URI,
silent_redirect_uri
:
'
http://localhost:8080/static/oidc_callback_silentRenew.html
'
,
popup_redirect_uri
:
'
http://localhost:8080/static/oidc_callback_popupRenew.html
'
,
response_type
:
'
id_token token
'
,
response_type
:
'
id_token token
'
,
scope
:
'
openid profile email
'
,
scope
:
'
openid profile email
'
,
post_logout_redirect_uri
:
process
.
env
.
API_STEERING_OIDC_REDIRECT_URI_POSTLOGOUT
,
post_logout_redirect_uri
:
process
.
env
.
API_STEERING_OIDC_REDIRECT_URI_POSTLOGOUT
,
loadUserInfo
:
true
loadUserInfo
:
true
,
automaticSilentRenew
:
true
})
})
}
}
},
},
...
@@ -89,6 +93,9 @@ export default {
...
@@ -89,6 +93,9 @@ export default {
self
.
user
.
name
=
u
.
profile
.
nickname
self
.
user
.
name
=
u
.
profile
.
nickname
self
.
user
.
email
=
u
.
profile
.
email
self
.
user
.
email
=
u
.
profile
.
email
self
.
user
.
access_token
=
u
.
access_token
self
.
user
.
access_token
=
u
.
access_token
console
.
log
(
new
Date
(
u
.
expires_at
*
1000
).
toString
())
console
.
log
(
new
Date
(
u
.
expires_at
*
1000
).
toUTCString
())
console
.
log
(
u
.
access_token
)
}
}
}).
catch
(
function
(
err
)
{
}).
catch
(
function
(
err
)
{
console
.
log
(
err
)
console
.
log
(
err
)
...
@@ -96,7 +103,31 @@ export default {
...
@@ -96,7 +103,31 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
// TODO: remove oidc logging after thorough testing
oidc
.
Log
.
logger
=
console
let
self
=
this
this
.
mgr
.
events
.
addSilentRenewError
(
function
()
{
// TODO: set accessTokenExpiringNotificationTime when this.mgr is created and insert this value here too
alert
(
'
Your OpenID access token could not be renewed automatically. You will be logged out in 60 seconds.
'
)
})
this
.
mgr
.
events
.
addAccessTokenExpiring
(
function
()
{
console
.
log
(
'
token will soon expire
'
)
console
.
log
(
self
)
/* Use the following code instead of silent renewal if you want to use popups
console.log('starting signinPopup')
self.mgr.signinPopup(function (user) {
console.log('signinPopup result for user:')
console.log(user)
}).catch(function (err) {
console.log(err)
})
*/
})
this
.
mgr
.
events
.
addAccessTokenExpired
(
function
()
{
console
.
log
(
'
expired!
'
)
})
this
.
getUser
()
this
.
getUser
()
this
.
mgr
.
startSilentRenew
()
}
}
}
}
</
script
>
</
script
>
...
...
src/components/Header.vue
View file @
aa220d26
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
<b-dropdown-item
href=
"#"
>
Profile
</b-dropdown-item>
<b-dropdown-item
href=
"#"
>
Profile
</b-dropdown-item>
<b-dropdown-item
@
click=
'$parent.signOut'
>
Signout
</b-dropdown-item>
<b-dropdown-item
@
click=
'$parent.signOut'
>
Signout
</b-dropdown-item>
</b-nav-item-dropdown>
</b-nav-item-dropdown>
<b-nav-item
v-if=
"! user.logged_in"
to=
"
login
"
><img
src=
"../assets/16x16/system-users.png"
alt=
"log-in symbol"
title=
"Log in"
></b-nav-item>
<b-nav-item
v-if=
"! user.logged_in"
to=
"
home
"
><img
src=
"../assets/16x16/system-users.png"
alt=
"log-in symbol"
title=
"Log in"
></b-nav-item>
<div
class=
"help-image-container"
>
<div
class=
"help-image-container"
>
<b-nav-item>
<b-nav-item>
<router-link
to=
"help"
><img
class=
"help-image"
src=
"../assets/help-browser-32x32.png"
alt=
"Help symbol"
title=
"Go to help pages"
></router-link>
<router-link
to=
"help"
><img
class=
"help-image"
src=
"../assets/help-browser-32x32.png"
alt=
"Help symbol"
title=
"Go to help pages"
></router-link>
...
...
static/oidc_callback.html
View file @
aa220d26
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<script>
<script>
var
mgr
=
new
Oidc
.
UserManager
({
userStore
:
new
Oidc
.
WebStorageStateStore
()})
var
mgr
=
new
Oidc
.
UserManager
({
userStore
:
new
Oidc
.
WebStorageStateStore
()})
mgr
.
signinRedirectCallback
().
then
(
function
(
user
)
{
mgr
.
signinRedirectCallback
().
then
(
function
(
user
)
{
console
.
log
(
user
)
window
.
location
.
href
=
'
../
'
window
.
location
.
href
=
'
../
'
}).
catch
(
function
(
err
)
{
}).
catch
(
function
(
err
)
{
console
.
log
(
err
)
console
.
log
(
err
)
...
...
static/oidc_callback_popupRenew.html
0 → 100644
View file @
aa220d26
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Waiting...
</title>
</head>
<body>
<script
src=
"oidc-client.js"
></script>
<script>
var
mgr
=
new
Oidc
.
UserManager
()
mgr
.
signinPopupCallback
()
</script>
</body>
</html>
static/oidc_callback_silentRenew.html
0 → 100644
View file @
aa220d26
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Waiting...
</title>
</head>
<body>
<script
src=
"oidc-client.js"
></script>
<script>
var
mgr
=
new
Oidc
.
UserManager
()
mgr
.
signinSilentCallback
()
</script>
</body>
</html>
Write
Preview
Supports
Markdown
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