public void Test_AuthenticateThrowsException_If_PrincipalPassword_Is_Not_Set() { var configuration = GetMockConfiguration(new Dictionary <string, string>()); var issuer = new KerberosTicketIssuer(GetAuthenticatorStub("foo"), configuration); Assert.Throws <ArgumentNullException>(() => issuer.Authenticate(Convert.ToBase64String(Encoding.UTF8.GetBytes("Hello World")))); }
public void Test_Authenticates_And_Issues_A_Ticket_If_PrincipalPassword_Is_Set() { var configuration = GetMockConfiguration(new Dictionary <string, string>() { { AuthConstants.PRINCIPAL_PASSWORD_NM, "foo" } }); var issuer = new KerberosTicketIssuer(GetAuthenticatorStub("bar"), configuration); var claimsIdentity = issuer.Authenticate(Convert.ToBase64String(Encoding.UTF8.GetBytes("Hello World"))); Assert.Equal("bar", claimsIdentity.Principal.Identity.Name); }