public async void EmptyOwinEnvironment() { var parser = new PostBodySecretParser(); var context = new OwinContext(); context.Request.Body = new MemoryStream(); var secret = await parser.ParseAsync(context.Environment); secret.Should().BeNull(); }
public async void Missing_ClientSecret() { var parser = new PostBodySecretParser(); var context = new OwinContext(); var body = "client_id=client"; context.Request.Body = new MemoryStream(Encoding.UTF8.GetBytes(body)); var secret = await parser.ParseAsync(context.Environment); secret.Should().BeNull(); }
public async void Valid_PostBody() { var parser = new PostBodySecretParser(); var context = new OwinContext(); var body = "client_id=client&client_secret=secret"; context.Request.Body = new MemoryStream(Encoding.UTF8.GetBytes(body)); var secret = await parser.ParseAsync(context.Environment); secret.Type.Should().Be(Constants.ParsedSecretTypes.SharedSecret); secret.Id.Should().Be("client"); secret.Credential.Should().Be("secret"); }