コード例 #1
0
        public uint FinishAuthentication(FidoStartedAuthentication startedAuthentication,
                                         FidoAuthenticateResponse authResponse,
                                         FidoDeviceRegistration deviceRegistration,
                                         IEnumerable <FidoFacetId> trustedFacetIds)
        {
            authResponse.Validate();

            var clientData = authResponse.ClientData;

            ExpectClientDataType(clientData, AuthenticateType);

            if (clientData.Challenge != startedAuthentication.Challenge)
            {
                throw new InvalidOperationException("Incorrect challenge signed in client data");
            }

            ValidateOrigin(trustedFacetIds, new FidoFacetId(clientData.Origin));

            var signatureData = authResponse.SignatureData;

            VerifyAuthSignature(startedAuthentication.AppId, signatureData, clientData, deviceRegistration);

            deviceRegistration.UpdateCounter(signatureData.Counter);
            return(signatureData.Counter);
        }
コード例 #2
0
        public uint FinishAuthentication(FidoStartedAuthentication startedAuthentication,
                                         string rawAuthResponse,
                                         FidoDeviceRegistration deviceRegistration,
                                         IEnumerable <FidoFacetId> trustedFacetIds)
        {
            var authResponse = FidoAuthenticateResponse.FromJson(rawAuthResponse);

            return(FinishAuthentication(startedAuthentication, authResponse, deviceRegistration, trustedFacetIds));
        }