named key
This commit is contained in:
parent
0cdd0b3b07
commit
6509053fa8
|
@ -19,6 +19,9 @@
|
||||||
<form id="formRegisterKey" method="post">
|
<form id="formRegisterKey" method="post">
|
||||||
{{ fido_token_form.csrf_token }}
|
{{ fido_token_form.csrf_token }}
|
||||||
{{ fido_token_form.sk_assertion(class="form-control", placeholder="") }}
|
{{ fido_token_form.sk_assertion(class="form-control", placeholder="") }}
|
||||||
|
|
||||||
|
{{ fido_token_form.key_name(class="form-control", placeholder="Name of your key (Required)") }}
|
||||||
|
{{ render_field_errors(fido_token_form.key_name) }}
|
||||||
</form>
|
</form>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<button id="btnRegisterKey" class="btn btn-lg btn-primary mt-2">Register Key</button>
|
<button id="btnRegisterKey" class="btn btn-lg btn-primary mt-2">Register Key</button>
|
||||||
|
@ -53,7 +56,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#btnRegisterKey").click(registerKey);
|
$("#btnRegisterKey").click(registerKey);
|
||||||
$('document').ready(registerKey());
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@ import webauthn
|
||||||
from flask import render_template, flash, redirect, url_for, session
|
from flask import render_template, flash, redirect, url_for, session
|
||||||
from flask_login import login_required, current_user
|
from flask_login import login_required, current_user
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from wtforms import HiddenField, validators
|
from wtforms import StringField, HiddenField, validators
|
||||||
|
|
||||||
from app.config import RP_ID, URL
|
from app.config import RP_ID, URL
|
||||||
from app.dashboard.base import dashboard_bp
|
from app.dashboard.base import dashboard_bp
|
||||||
|
@ -18,6 +18,7 @@ from app.dashboard.views.enter_sudo import sudo_required
|
||||||
|
|
||||||
|
|
||||||
class FidoTokenForm(FlaskForm):
|
class FidoTokenForm(FlaskForm):
|
||||||
|
key_name = StringField("key_name", validators=[validators.DataRequired()])
|
||||||
sk_assertion = HiddenField("sk_assertion", validators=[validators.DataRequired()])
|
sk_assertion = HiddenField("sk_assertion", validators=[validators.DataRequired()])
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ def fido_setup():
|
||||||
uuid=fido_uuid,
|
uuid=fido_uuid,
|
||||||
public_key=str(fido_credential.public_key, "utf-8"),
|
public_key=str(fido_credential.public_key, "utf-8"),
|
||||||
sign_count=fido_credential.sign_count,
|
sign_count=fido_credential.sign_count,
|
||||||
|
name=fido_token_form.key_name.data,
|
||||||
)
|
)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ class FIDO(db.Model, ModelMixin):
|
||||||
)
|
)
|
||||||
public_key = db.Column(db.String(), nullable=False, unique=True)
|
public_key = db.Column(db.String(), nullable=False, unique=True)
|
||||||
sign_count = db.Column(db.Integer(), nullable=False)
|
sign_count = db.Column(db.Integer(), nullable=False)
|
||||||
|
name = db.Column(db.String(128), nullable=False, unique=False)
|
||||||
|
|
||||||
|
|
||||||
class User(db.Model, ModelMixin, UserMixin):
|
class User(db.Model, ModelMixin, UserMixin):
|
||||||
|
|
|
@ -148,16 +148,18 @@ def fake_data():
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
FIDO.create(
|
FIDO.create(
|
||||||
credential_id="umR9q5vX61XG7vh7gi8wT0gJ9LkYwHKSzDL5vhtZs3o",
|
credential_id="el29kSg3Ai0c9Tsn9F0vXDdqKrs3jHLeU0J1NLN1Sjs",
|
||||||
uuid="59576167-6c37-4d67-943b-4683b24ff821",
|
uuid="59576167-6c37-4d67-943b-4683b24ff821",
|
||||||
public_key="pQECAyYgASFYIEjQg3TOuUZJxylLE6gJDNHcNyYVW5hOAZ-vGOY9I_TDIlggfJqIh07bj3n6RVmrEsuozsYPYM6VeJKCeduz0DFp8AY",
|
public_key="pQECAyYgASFYIP8Xb0pXtSlmn8oji445s_FkEZsld6NCxx19YXyEt5h1IlggTw30aVvtA2sn7qyn3BE0Ux5NPJFSmABYZmT_P35Q9EIs",
|
||||||
sign_count=1,
|
sign_count=1,
|
||||||
|
name="testA",
|
||||||
)
|
)
|
||||||
FIDO.create(
|
FIDO.create(
|
||||||
credential_id="4SaUPugJ2sAErSnZil6_5_wXIL-Sk6QdFmNm94IL-_g",
|
credential_id="4SaUPugJ2sAErSnZil6_5_wXIL-Sk6QdFmNm94IL-_g",
|
||||||
uuid="59576167-6c37-4d67-943b-4683b24ff821",
|
uuid="59576167-6c37-4d67-943b-4683b24ff821",
|
||||||
public_key="pQECAyYgASFYILfse0JIp0a7Gz7n1K8b75_OgV-iliKr52FB-BGzv2R2IlggsPcViY5Dma8XooLWUHtx7X2_px0MsFR_7VRMwT2OHKg",
|
public_key="pQECAyYgASFYILfse0JIp0a7Gz7n1K8b75_OgV-iliKr52FB-BGzv2R2IlggsPcViY5Dma8XooLWUHtx7X2_px0MsFR_7VRMwT2OHKg",
|
||||||
sign_count=1,
|
sign_count=1,
|
||||||
|
name="testB",
|
||||||
)
|
)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue