we have a web application built in c# and Angularjs and config to use windows authentication, recently I removed Windows Auth and add Single Sign-On (Azure AD), the problem once I entered my credentials and click logging it never takes me to the web app its like is in a loop trying to log in, this is how my log looks like.
2018-05-10 16:28:05 ::1 POST /portal - 443 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:59.0)+Gecko/20100101+Firefox/59.0 https://login.microsoftonline.com/f8b6a2d7-0364-40ce-943e-eb02d6c35deb/oauth2/authorize?client_id=359xxxx2-877e-xxx-9538-9e_xxxxxxxxxxxxxxxxxxxx
2018-05-10 16:28:05 ::1 GET /portal - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:59.0)+Gecko/20100101+Firefox/59.0 - 302 0 0 2
2018-05-10 16:28:35 ::1 POST /portal - 443 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:59.0)+Gecko/20100101+Firefox/59.0 https://login.microsoftonline.com/f8b6axce-943e-eb02dxdeb/oauth2/authx272-877e-4xx4-9538-9e63a5a810d32Exxxxxxx.40306.1x54 302 0 64 29x4
2018-05-10 16:36:15 ::1 GET /portal - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/66.0.3359.139+Safari/537.36 - 302 0 0 2
2018-05-10 16:37:36 ::1 POST /portal - 443 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/66.0.3359.139+Safari/537.36 https://login.microsoftonline.com/kmsi 302 0 64 43715
And like that on and on!
my StartUp.Auth.cs
public void ConfigureAuth(IAppBuilder app)
{
ApplicationDbContext db = new ApplicationDbContext();
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = Authority,
PostLogoutRedirectUri = postLogoutRedirectUri,
Notifications = new OpenIdConnectAuthenticationNotifications()
{
// If there is a code in the OpenID Connect response, redeem it for an access token and refresh token, and store those away.
AuthorizationCodeReceived = (context) =>
{
var code = context.Code;
ClientCredential credential = new ClientCredential(clientId, appKey);
string signedInUserID = context.AuthenticationTicket.Identity.FindFirst(ClaimTypes.NameIdentifier).Value;
AuthenticationContext authContext = new AuthenticationContext(Authority, new ADALTokenCache(signedInUserID));
return authContext.AcquireTokenByAuthorizationCodeAsync(
code, new Uri(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path)), credential, graphResourceId);
}
}
Any Suggestion what might be happening here