Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Graphics generator
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
to-generator
Graphics generator
Commits
9c1745f9
Commit
9c1745f9
authored
Aug 15, 2022
by
Tomáš Hozman
Browse files
Options
Downloads
Patches
Plain Diff
set dependency versions, removed deprectated FLASK_ENV
parent
64755105
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#9224
passed
Aug 15, 2022
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
generator/authentication/__init__.py
+26
-26
26 additions, 26 deletions
generator/authentication/__init__.py
with
26 additions
and
26 deletions
generator/authentication/__init__.py
+
26
−
26
View file @
9c1745f9
...
...
@@ -17,32 +17,32 @@ def authenticate_via_jwt(
@functools.wraps
(
func
)
def
decorator
(
*
args
,
**
kwargs
)
->
typing
.
Any
:
#
if "token" not in flask.request.cookies:
#
return flask.redirect(
#
flask.url_for("oidc.login")
#
)
#
try:
#
claims = authlib.jose.jwt.decode(
#
flask.request.cookies["token"],
#
flask.current_app.config["JWT_SECRET_KEY"]
#
)
#
except authlib.jose.JoseError as exception:
#
raise werkzeug.exceptions.BadRequest from exception
#
try:
#
claims.validate()
#
except authlib.jose.JoseError as exception:
#
flask.current_app.logger.debug(
#
"Claim validation failed: %s",
#
exception
#
)
#
return flask.redirect(
#
flask.url_for("oidc.login")
#
)
flask
.
g
.
user_id
=
"
1
"
if
"
token
"
not
in
flask
.
request
.
cookies
:
return
flask
.
redirect
(
flask
.
url_for
(
"
oidc.login
"
)
)
try
:
claims
=
authlib
.
jose
.
jwt
.
decode
(
flask
.
request
.
cookies
[
"
token
"
],
flask
.
current_app
.
config
[
"
JWT_SECRET_KEY
"
]
)
except
authlib
.
jose
.
JoseError
as
exception
:
raise
werkzeug
.
exceptions
.
BadRequest
from
exception
try
:
claims
.
validate
()
except
authlib
.
jose
.
JoseError
as
exception
:
flask
.
current_app
.
logger
.
debug
(
"
Claim validation failed: %s
"
,
exception
)
return
flask
.
redirect
(
flask
.
url_for
(
"
oidc.login
"
)
)
flask
.
g
.
user_id
=
claims
[
"
sub
"
]
return
func
(
*
args
,
**
kwargs
)
return
decorator
This diff is collapsed.
Click to expand it.
Alexa Valentová
@alexa.valentova
·
Aug 15, 2022
Owner
Accidentally left an OpenID bypass in there. Not related to other changes
Accidentally left an OpenID bypass in there. Not related to other changes
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
sign in
to comment