Exemplo n.º 1
0
        public async Task <ActionResult> ShowSecret(ShowSecretViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var adminStore = new IdentityServer3AdminStore();
            ProtectedSecretQueryValues queryValues = new ProtectedSecretQueryValues()
            {
                ClientId = model.ClientId,
                Value    = model.Hash
            };
            var record = await adminStore.FindSecretProtectedValue(queryValues);

            var myCrypto = new TripleDesEncryption(model.PassCode);

            model.OpenSecret = myCrypto.Decrypt(record.ProtectedValue);
            return(RedirectToAction("ShowOpenSecret",
                                    new { clientId = model.ClientId, hash = model.Hash, openSecret = model.OpenSecret, passCode = model.PassCode }));
        }