Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auth_saml
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
auth_saml
Commits
12b7ff5c71cf
Commit
12b7ff5c71cf
authored
8 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Don't add different states twice to the same URL
parent
8b042b14ecfe
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
controllers/main.py
+10
-10
10 additions, 10 deletions
controllers/main.py
with
10 additions
and
10 deletions
controllers/main.py
+
10
−
10
View file @
12b7ff5c
...
@@ -97,6 +97,12 @@
...
@@ -97,6 +97,12 @@
class
AuthSAMLController
(
http
.
Controller
):
class
AuthSAMLController
(
http
.
Controller
):
def
get_state
(
self
,
provider_id
):
def
get_state
(
self
,
provider_id
):
"""
Compute a state to be sent to the IDP so it can forward it back to
us.
:rtype: Dictionary.
"""
redirect
=
request
.
params
.
get
(
'
redirect
'
)
or
'
web
'
redirect
=
request
.
params
.
get
(
'
redirect
'
)
or
'
web
'
if
not
redirect
.
startswith
((
'
//
'
,
'
http://
'
,
'
https://
'
)):
if
not
redirect
.
startswith
((
'
//
'
,
'
http://
'
,
'
https://
'
)):
redirect
=
'
%s%s
'
%
(
redirect
=
'
%s%s
'
%
(
...
@@ -121,6 +127,9 @@
...
@@ -121,6 +127,9 @@
provider_osv
=
request
.
registry
.
get
(
'
auth.saml.provider
'
)
provider_osv
=
request
.
registry
.
get
(
'
auth.saml.provider
'
)
auth_request
=
None
auth_request
=
None
# store a RelayState on the request to our IDP so that the IDP
# can send us back this info alongside the obtained token
state
=
self
.
get_state
(
provider_id
)
state
=
self
.
get_state
(
provider_id
)
try
:
try
:
...
@@ -133,16 +142,7 @@
...
@@ -133,16 +142,7 @@
# TODO: handle case when auth_request comes back as None
# TODO: handle case when auth_request comes back as None
# store a RelayState on the request to our IDP so that the IDP
redirect
=
werkzeug
.
utils
.
redirect
(
auth_request
,
303
)
# can send us back this info alongside the obtained token
params
=
{
"
RelayState
"
:
simplejson
.
dumps
({
"
d
"
:
request
.
session
.
db
,
"
p
"
:
pid
,
}),
}
url
=
auth_request
+
"
&
"
+
werkzeug
.
url_encode
(
params
)
redirect
=
werkzeug
.
utils
.
redirect
(
url
,
303
)
redirect
.
autocorrect_location_header
=
True
redirect
.
autocorrect_location_header
=
True
return
redirect
return
redirect
...
...
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