Fix storing passkeys
This commit is contained in:
@@ -32,7 +32,7 @@ FROM base AS build
|
|||||||
|
|
||||||
# Install packages needed to build gems
|
# Install packages needed to build gems
|
||||||
RUN apt-get update -qq && \
|
RUN apt-get update -qq && \
|
||||||
apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config && \
|
apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config libssl-dev && \
|
||||||
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||||
|
|
||||||
# Install application gems
|
# Install application gems
|
||||||
|
|||||||
@@ -146,9 +146,13 @@ class SessionsController < ApplicationController
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
# Generate authentication options
|
# Generate authentication options
|
||||||
# The WebAuthn gem will handle base64url encoding automatically
|
# Decode the stored base64url credential IDs before passing to the gem
|
||||||
|
credential_ids = user.webauthn_credentials.pluck(:external_id).map do |encoded_id|
|
||||||
|
Base64.urlsafe_decode64(encoded_id)
|
||||||
|
end
|
||||||
|
|
||||||
options = WebAuthn::Credential.options_for_get(
|
options = WebAuthn::Credential.options_for_get(
|
||||||
allow: user.webauthn_credentials.pluck(:external_id),
|
allow: credential_ids,
|
||||||
user_verification: "preferred"
|
user_verification: "preferred"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user