Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
806
Merge Requests
53
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
0c98f7a6
Commit
0c98f7a6
authored
23 minutes ago
by
Emiliano Balbuena
Browse files
Options
Download
(feat): SSO flow upon page initialization
parent
82b76f63
goal/pro-sso
1 merge request
!656
WIP: SSO for Pro sites
Pipeline
#96000549
running with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
src/app/common/services/sso.service.ts
View file @
0c98f7a6
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
SiteService
}
from
'
./site.service
'
;
import
{
Client
}
from
'
../../services/api/client
'
;
import
{
Session
}
from
'
../../services/session
'
;
@
Injectable
()
export
class
SsoService
{
protected
readonly
minds
=
window
.
Minds
;
constructor
(
protected
site
:
SiteService
,
protected
client
:
Client
)
{}
constructor
(
protected
site
:
SiteService
,
protected
client
:
Client
,
protected
session
:
Session
)
{}
isRequired
():
boolean
{
return
this
.
site
.
isProDomain
;
...
...
@@ -14,9 +19,22 @@ export class SsoService {
async
connect
()
{
try
{
const
response
:
any
=
await
this
.
client
.
postRaw
(
const
connect
:
any
=
await
this
.
client
.
postRaw
(
`
${
this
.
minds
.
site_url
}
api/v2/sso/connect`
);
if
(
connect
&&
connect
.
status
===
'
success
'
)
{
// TODO: Use headers
const
authorization
:
any
=
await
this
.
client
.
post
(
'
api/v2/sso/authorize
'
,
{
token
:
connect
.
token
,
}
);
window
.
Minds
.
user
=
authorization
.
user
;
this
.
session
.
login
(
window
.
Minds
.
user
);
}
}
catch
(
e
)
{
console
.
error
(
e
);
}
...
...
This diff is collapsed.
Please
register
or
sign in
to comment