Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Hiboo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
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
cyrinux
Hiboo
Commits
e01063e3
Commit
e01063e3
authored
5 years ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Use a hack to access the client object from the OIDC Code Mixin
parent
96621ca0
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
hiboo/sso/oidc.py
+9
-7
9 additions, 7 deletions
hiboo/sso/oidc.py
with
9 additions
and
7 deletions
hiboo/sso/oidc.py
+
9
−
7
View file @
e01063e3
...
@@ -103,14 +103,17 @@ class OpenIDMixin(object):
...
@@ -103,14 +103,17 @@ class OpenIDMixin(object):
def
exists_nonce
(
self
,
nonce
,
request
):
def
exists_nonce
(
self
,
nonce
,
request
):
return
bool
(
utils
.
redis
.
get
(
"
nonce:{}
"
.
format
(
nonce
)))
return
bool
(
utils
.
redis
.
get
(
"
nonce:{}
"
.
format
(
nonce
)))
def
get_client
(
self
):
# TODO: this is a terribly ugly hack meant only as a temporary measure
# waiting for authlib to merge our PRs allowing a more generic way of
# always having the current client in the context.
return
inspect
.
currentframe
().
f_back
.
f_back
.
f_back
.
f_locals
[
"
self
"
].
client
def
get_jwt_config
(
self
,
grant
=
None
):
def
get_jwt_config
(
self
,
grant
=
None
):
# In the case of AuthorizationCode, the current object is not the grant
return
self
.
get_client
().
get_jwt_config
()
# but a grant extension, so the client is retrieved through the grant argument
client
=
self
.
request
.
client
if
grant
is
None
else
grant
.
client
return
client
.
get_jwt_config
()
def
generate_user_info
(
self
,
user
,
scope
):
def
generate_user_info
(
self
,
user
,
scope
):
return
C
lient
.
generate_user_info
(
user
,
scope
)
return
self
.
get_c
lient
()
.
generate_user_info
(
user
,
scope
)
class
Client
(
sqla_oauth2
.
OAuth2ClientMixin
):
class
Client
(
sqla_oauth2
.
OAuth2ClientMixin
):
...
@@ -157,8 +160,7 @@ class Client(sqla_oauth2.OAuth2ClientMixin):
...
@@ -157,8 +160,7 @@ class Client(sqla_oauth2.OAuth2ClientMixin):
'
exp
'
:
3600
,
'
exp
'
:
3600
,
}
}
@classmethod
def
generate_user_info
(
self
,
user
,
scope
):
def
generate_user_info
(
cls
,
user
,
scope
):
"""
User info generation function used by the oidc code mixin and the userinfo endpoint
"""
User info generation function used by the oidc code mixin and the userinfo endpoint
"""
"""
return
oidc
.
UserInfo
(
return
oidc
.
UserInfo
(
...
...
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