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
9cdd354db735
"README.rst" did not exist on "d2a63514d3587ce0e1ebe80f0648024a9c9a6679"
Commit
9cdd354db735
authored
8 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Odoo 8 style override of "res.users::check_credentials"
parent
bcd11c9d1587
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
model/res_users.py
+11
-10
11 additions, 10 deletions
model/res_users.py
with
11 additions
and
10 deletions
model/res_users.py
+
11
−
10
View file @
9cdd354d
...
...
@@ -223,7 +223,9 @@
# return user credentials
return
self
.
env
.
cr
.
dbname
,
login
,
saml_response
# This method is using the old v7 API because it is called BEFORE the login
def
check_credentials
(
self
,
cr
,
uid
,
token
):
"""
token can be a password if the user has used the normal form...
@api.model
def
check_credentials
(
self
,
token
):
"""
Override to handle SAML auths.
The token can be a password if the user has used the normal form...
but we are more interested in the case when they are tokens
...
...
@@ -229,3 +231,3 @@
but we are more interested in the case when they are tokens
and the interesting code is inside the except clause
and the interesting code is inside the
"
except
"
clause
.
"""
...
...
@@ -231,4 +233,3 @@
"""
token_osv
=
self
.
pool
.
get
(
'
auth_saml.token
'
)
try
:
...
...
@@ -233,6 +234,7 @@
try
:
super
(
ResUser
,
self
).
check_credentials
(
cr
,
uid
,
token
)
# Attempt a regular login (via other auth addons) first.
super
(
ResUser
,
self
).
check_credentials
(
token
)
except
(
openerp
.
exceptions
.
AccessDenied
,
...
...
@@ -240,6 +242,5 @@
):
# since normal auth did not succeed we now try to find if the user
# has an active token attached to his uid
res
=
token_osv
.
search
(
cr
,
SUPERUSER_ID
,
res
=
self
.
env
[
'
auth_saml.token
'
].
sudo
().
search
(
[
...
...
@@ -245,3 +246,3 @@
[
(
'
user_id
'
,
'
=
'
,
u
id
),
(
'
user_id
'
,
'
=
'
,
self
.
env
.
user
.
id
),
(
'
saml_access_token
'
,
'
=
'
,
token
),
...
...
@@ -247,5 +248,5 @@
(
'
saml_access_token
'
,
'
=
'
,
token
),
]
]
,
)
# if the user is not found we re-raise the AccessDenied
...
...
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