Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hiboo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Show more breadcrumbs
frju365
Hiboo
Commits
2c9fbc62
Commit
2c9fbc62
authored
4 years ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Fix the code checking the sso type
parent
40bf42fb
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
hiboo/application/base.py
+3
-2
3 additions, 2 deletions
hiboo/application/base.py
hiboo/sso/__init__.py
+1
-1
1 addition, 1 deletion
hiboo/sso/__init__.py
hiboo/sso/oidc.py
+3
-3
3 additions, 3 deletions
hiboo/sso/oidc.py
hiboo/sso/saml.py
+2
-2
2 additions, 2 deletions
hiboo/sso/saml.py
with
9 additions
and
8 deletions
hiboo/application/base.py
+
3
−
2
View file @
2c9fbc62
from
hiboo
import
sso
from
hiboo.service.forms
import
ServiceForm
as
BaseForm
from
flask_babel
import
lazy_gettext
as
_
...
...
@@ -31,9 +32,9 @@ class BaseApplication(object):
class
OIDCApplication
(
BaseApplication
):
sso_protocol
=
"
oidc
"
sso_protocol
=
sso
.
oidc
class
SAMLApplication
(
BaseApplication
):
sso_protocol
=
"
saml
"
sso_protocol
=
sso
.
saml
This diff is collapsed.
Click to expand it.
hiboo/sso/__init__.py
+
1
−
1
View file @
2c9fbc62
...
...
@@ -11,7 +11,7 @@ def get_service(service_uuid, expected_protocol):
"""
service
=
models
.
Service
.
query
.
get
(
service_uuid
)
or
flask
.
abort
(
404
)
app
=
application
.
registry
.
get
(
service
.
application_id
)
or
flask
.
abort
(
404
)
app
.
sso_protocol
==
expected_protocol
or
flask
.
abort
(
404
)
app
.
sso_protocol
.
__name__
==
expected_protocol
or
flask
.
abort
(
404
)
return
service
...
...
This diff is collapsed.
Click to expand it.
hiboo/sso/oidc.py
+
3
−
3
View file @
2c9fbc62
...
...
@@ -165,20 +165,20 @@ class Client(sqla_oauth2.OAuth2ClientMixin):
@blueprint.route
(
"
/oidc/authorize/<service_uuid>
"
,
methods
=
[
"
GET
"
,
"
POST
"
])
def
oidc_authorize
(
service_uuid
):
client
=
Client
(
get_service
(
service_uuid
,
"
oidc
"
))
client
=
Client
(
get_service
(
service_uuid
,
__name__
))
picked
=
profile
.
get_profile
(
client
.
service
,
intent
=
True
)
or
flask
.
abort
(
403
)
return
client
.
authorization
.
create_authorization_response
(
grant_user
=
picked
)
@blueprint.route
(
"
/oidc/token/<service_uuid>
"
,
methods
=
[
"
POST
"
])
def
oidc_token
(
service_uuid
):
client
=
Client
(
get_service
(
service_uuid
,
"
oidc
"
))
client
=
Client
(
get_service
(
service_uuid
,
__name__
))
return
client
.
authorization
.
create_token_response
()
@blueprint.route
(
"
/oidc/userinfo/<service_uuid>
"
,
methods
=
[
"
GET
"
,
"
POST
"
])
def
oidc_userinfo
(
service_uuid
):
client
=
Client
(
get_service
(
service_uuid
,
"
oidc
"
))
client
=
Client
(
get_service
(
service_uuid
,
__name__
))
token
=
client
.
validate_token
(
flask
.
request
)
profile
=
models
.
Profile
.
query
.
get
(
token
[
"
profile_uuid
"
])
return
client
.
generate_user_info
(
profile
,
token
[
"
scope
"
])
This diff is collapsed.
Click to expand it.
hiboo/sso/saml.py
+
2
−
2
View file @
2c9fbc62
...
...
@@ -129,7 +129,7 @@ class MetaData(mdstore.InMemoryMetaData):
@blueprint.route
(
"
/saml/redirect/<service_uuid>
"
,
methods
=
[
"
GET
"
,
"
POST
"
])
def
saml_redirect
(
service_uuid
):
service
=
get_service
(
service_uuid
,
"
saml
"
)
service
=
get_service
(
service_uuid
,
__name__
)
# Get the profile from user input (implies redirects)
picked
=
profile
.
get_profile
(
service
,
intent
=
True
)
or
flask
.
abort
(
403
)
# Parse the authentication request (which checks the signature)
...
...
@@ -160,7 +160,7 @@ def saml_redirect(service_uuid):
@blueprint.route
(
"
/saml/metadata/<service_uuid>.xml
"
)
def
saml_metadata
(
service_uuid
):
service
=
get_service
(
service_uuid
,
"
saml
"
)
service
=
get_service
(
service_uuid
,
__name__
)
config
=
MetaData
.
get_config
(
service
)
xml
,
_
=
metadata
.
entities_descriptor
(
[
metadata
.
entity_descriptor
(
config
)],
...
...
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