Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
4ff13bae
Commit
4ff13bae
authored
5 years ago
by
Reiter, Christoph
Browse files
Options
Downloads
Patches
Plain Diff
Use dynamic import() for the keycloack library
parent
c1d992e1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/auth/src/vpu-auth.js
+12
-13
12 additions, 13 deletions
packages/auth/src/vpu-auth.js
with
12 additions
and
13 deletions
packages/auth/src/vpu-auth.js
+
12
−
13
View file @
4ff13bae
...
...
@@ -18,6 +18,13 @@ const LoginStatus = Object.freeze({
});
async
function
importKeycloak
()
{
const
keycloakSrc
=
'
//auth-dev.tugraz.at/auth/js/keycloak.min.js
'
;
await
import
(
keycloakSrc
);
return
window
.
Keycloak
;
}
/**
* Keycloak auth web component
* https://www.keycloak.org/docs/latest/securing_apps/index.html#_javascript_adapter
...
...
@@ -145,11 +152,7 @@ class VPUAuth extends VPULitElement {
const
that
=
this
;
if
(
!
this
.
keyCloakInitCalled
)
{
// inject Keycloak javascript file
const
script
=
document
.
createElement
(
'
script
'
);
script
.
type
=
'
text/javascript
'
;
//script.async = true;
script
.
onload
=
()
=>
{
importKeycloak
().
then
((
Keycloak
)
=>
{
that
.
keyCloakInitCalled
=
true
;
that
.
_keycloak
=
Keycloak
({
...
...
@@ -214,14 +217,10 @@ class VPUAuth extends VPULitElement {
}).
error
(
function
()
{
console
.
log
(
'
Failed to refresh the token, or the session has expired
'
);
});
}
};
// https://www.keycloak.org/docs/latest/securing_apps/index.html#_javascript_a
script
.
src
=
'
//auth-dev.tugraz.at/auth/js/keycloak.min.js
'
;
//Append it to the document header
document
.
head
.
appendChild
(
script
);
};
}).
catch
((
e
)
=>
{
console
.
log
(
'
Loading keycloack failed
'
,
e
);
});
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment