Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SiB Auth
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Startin blox
framework
SiB Auth
Commits
31b2fb90
Commit
31b2fb90
authored
Apr 30, 2019
by
Jean-Baptiste
Committed by
Clément
Jul 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: somes bugs
parent
48ea2c21
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
26 deletions
+20
-26
index.html
index.html
+3
-3
sib-auth-provider.js
sib-auth-provider.js
+11
-13
sib-auth.js
sib-auth.js
+6
-10
No files found.
index.html
View file @
31b2fb90
...
...
@@ -69,8 +69,8 @@
return
this
.
getUser
();
}
update
()
{
const
user
=
this
.
getUser
();
async
update
()
{
const
user
=
await
this
.
getUser
();
if
(
user
)
{
result
.
innerHTML
=
`Bonjour
${
user
}
!`
;
}
else
{
...
...
@@ -81,4 +81,4 @@
customElements
.
define
(
'
sib-test
'
,
TestComponent
);
</script>
</body>
</html>
</html>
\ No newline at end of file
sib-auth-provider.js
View file @
31b2fb90
import
auth
from
'
https://dev.jspm.io/solid-auth-client
'
;
const
defaultSettings
=
{
redirect_uri
:
window
.
location
.
origin
,
post_logout_redirect_uri
:
window
.
location
.
origin
,
// authority: 'https://test-paris.happy-dev.fr/openid/',
// client_id: '833925',
response_type
:
'
id_token token
'
,
scope
:
'
openid profile email
'
,
automaticsilentrenew
:
'
true
'
,
loaduserinfo
:
'
true
'
,
};
class
SIBAuthProvider
extends
HTMLElement
{
/**
* @typedef {Object} State
...
...
@@ -25,12 +14,21 @@ class SIBAuthProvider extends HTMLElement {
}
/** @function
*
* @name connectedCallback
* When called, the OIDC manager is intancied
* with the params set in the component, render view
*/
async
connectedCallback
()
{
const
{
authority
,
id
}
=
this
.
dataset
;
// eslint-disable-line camelcase
this
.
id
=
id
;
this
.
render
(
this
.
dataset
);
}
/** @function
* @name disconnectedCallback
* Remove manager
*/
disconnectedCallback
()
{
this
.
manager
=
null
;
}
/** @function
...
...
sib-auth.js
View file @
31b2fb90
import
auth
from
'
https://dev.jspm.io/solid-auth-client
'
;
import
{
SIBBase
,
Helpers
}
from
'
https://unpkg.com/@startinblox/core@0.7
'
;
import
{
Helpers
,
SIBBase
}
from
'
https://unpkg.com/@startinblox/core@0.7
'
;
const
baseUrl
=
import
.
meta
.
url
.
replace
(
/
\/[^/]
*$/
,
''
);
Helpers
.
importCSS
(
`
${
baseUrl
}
/sib-auth.css`
);
...
...
@@ -15,7 +15,7 @@ class SIBAuth extends HTMLElement {
constructor
()
{
super
();
this
.
state
=
null
;
this
.
provider
=
null
;
this
.
user
=
null
;
this
.
hide
();
}
...
...
@@ -40,7 +40,6 @@ class SIBAuth extends HTMLElement {
disconnectedCallback
()
{
solid
.
auth
.
logout
()
.
then
(()
=>
alert
(
'
Goodbye!
'
));
this
.
clearState
();
this
.
uninstall
();
}
...
...
@@ -140,7 +139,7 @@ class SIBAuth extends HTMLElement {
* Try to get user, the if a state is set, call the appropriate provider
*/
async
processState
()
{
const
{
provider
}
=
this
.
getState
();
const
{
provider
}
=
this
.
getState
();
const
providerElement
=
this
.
getProvider
(
provider
);
if
(
providerElement
)
{
this
.
callProvider
(
providerElement
,
'
processState
'
,
this
);
...
...
@@ -189,7 +188,7 @@ class SIBAuth extends HTMLElement {
* Return User or undefined
* @return {User}
*/
getUserWebId
()
{
getUserWebId
()
{
return
new
Promise
((
resolve
,
error
)
=>
{
auth
.
trackSession
(
session
=>
{
if
(
!
session
)
{
...
...
@@ -219,11 +218,8 @@ class SIBAuth extends HTMLElement {
* @name logout
* Try to logout if favorite provider is set
*/
async
logout
()
{
const
favoriteProvider
=
this
.
getFavoriteProvider
();
if
(
favoriteProvider
)
{
this
.
callProvider
(
favoriteProvider
,
'
logout
'
,
this
);
}
logout
()
{
auth
.
logout
()
}
/** @function
...
...
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