Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uffd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luca (strifel)
uffd
Commits
29a60b3f
Commit
29a60b3f
authored
Oct 5, 2020
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
cleaned up webauthn model
parent
4b1539b3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
uffd/mfa/models.py
+7
-7
7 additions, 7 deletions
uffd/mfa/models.py
uffd/mfa/views.py
+4
-4
4 additions, 4 deletions
uffd/mfa/views.py
with
11 additions
and
11 deletions
uffd/mfa/models.py
+
7
−
7
View file @
29a60b3f
...
...
@@ -6,7 +6,7 @@ import crypt
from
flask
import
request
,
current_app
from
sqlalchemy
import
Column
,
Integer
,
Enum
,
Boolean
,
String
,
DateTime
,
Text
from
fido2.ctap2
import
A
uthenticator
Data
from
fido2.ctap2
import
A
ttestedCredential
Data
from
uffd.database
import
db
from
uffd.user.models
import
User
...
...
@@ -131,15 +131,15 @@ class WebauthnMethod(MFAMethod):
'
polymorphic_identity
'
:
MFAType
.
WEBAUTHN
}
def
__init__
(
self
,
user
,
cred
_data
,
name
=
None
):
def
__init__
(
self
,
user
,
cred
,
name
=
None
):
super
().
__init__
(
user
,
name
)
self
.
cred
_data
=
cred
_data
self
.
cred
=
cred
@property
def
cred
_data
(
self
):
return
A
uthenticator
Data
(
base64
.
b64decode
(
self
.
_cred
))
def
cred
(
self
):
return
A
ttestedCredential
Data
(
base64
.
b64decode
(
self
.
_cred
))
@cred
_data
.setter
def
cred
_data
(
self
,
d
):
@cred.setter
def
cred
(
self
,
d
):
self
.
_cred
=
base64
.
b64encode
(
bytes
(
d
))
This diff is collapsed.
Click to expand it.
uffd/mfa/views.py
+
4
−
4
View file @
29a60b3f
...
...
@@ -113,7 +113,7 @@ def setup_webauthn_begin():
if
not
RecoveryCodeMethod
.
query
.
filter_by
(
dn
=
user
.
dn
).
all
():
abort
(
403
)
methods
=
WebauthnMethod
.
query
.
filter_by
(
dn
=
user
.
dn
).
all
()
creds
=
[
method
.
cred
_data
.
credential_data
for
method
in
methods
]
creds
=
[
method
.
cred
for
method
in
methods
]
server
=
get_webauthn_server
()
registration_data
,
state
=
server
.
register_begin
(
{
...
...
@@ -137,7 +137,7 @@ def setup_webauthn_complete():
client_data
=
ClientData
(
data
[
"
clientDataJSON
"
])
att_obj
=
AttestationObject
(
data
[
"
attestationObject
"
])
auth_data
=
server
.
register_complete
(
session
[
"
webauthn-state
"
],
client_data
,
att_obj
)
method
=
WebauthnMethod
(
user
,
auth_data
,
name
=
data
[
'
name
'
])
method
=
WebauthnMethod
(
user
,
auth_data
.
credential_data
,
name
=
data
[
'
name
'
])
db
.
session
.
add
(
method
)
db
.
session
.
commit
()
return
cbor
.
dumps
({
"
status
"
:
"
OK
"
})
...
...
@@ -157,7 +157,7 @@ def auth_webauthn_begin():
user
=
get_current_user
()
server
=
get_webauthn_server
()
methods
=
WebauthnMethod
.
query
.
filter_by
(
dn
=
user
.
dn
).
all
()
creds
=
[
method
.
cred
_data
.
credential_data
for
method
in
methods
]
creds
=
[
method
.
cred
for
method
in
methods
]
if
not
creds
:
abort
(
404
)
auth_data
,
state
=
server
.
authenticate_begin
(
creds
,
user_verification
=
'
discouraged
'
)
...
...
@@ -169,7 +169,7 @@ def auth_webauthn_complete():
user
=
get_current_user
()
server
=
get_webauthn_server
()
methods
=
WebauthnMethod
.
query
.
filter_by
(
dn
=
user
.
dn
).
all
()
creds
=
[
method
.
cred
_data
.
credential_data
for
method
in
methods
]
creds
=
[
method
.
cred
for
method
in
methods
]
if
not
creds
:
abort
(
404
)
data
=
cbor
.
loads
(
request
.
get_data
())[
0
]
...
...
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