コード例 #1
0
        public async Task <IActionResult> GetToken([FromBody] TokenRequestModel model)
        {
            Guid nonce = model.Nonce;

            if (m_nonceStore.Exists(nonce))
            {
                var deviceModel = model.DeviceModel;


                if (await m_attestationService.IsValidAttestation(model.AttestationCypher, attestSecret, nonce))
                {
                    // Creating the token
                    TokenParams tokenParams = new TokenParams(jwtSecret, JwtIssuer, JwtAudience);
                    var         token       = m_tokenService.Generate(deviceModel, tokenParams);
                    return(Ok(token));
                }
            }

            return(Ok(m_tokenService.GenerateFakeToken()));
        }