Last post Nov 15, 2018 04:59 AM by emrulkayes2103
Nov 14, 2018 09:42 AM|emrulkayes2103|LINK
How can i enable Single Sign On using Asp.Net Identity Without Forms Authentication??? Is it possible ??
Can anyone please help me to implement ??
Nov 14, 2018 09:53 AM|PatriceSc|LINK
Tell rather what you want to use ? Sounds you want to use https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-2.1 ?
Edit: or you want to have your own identity server such as https://identityserver4.readthedocs.io/en/release/ ? The first step is likely to understand where accounts are authenticated. They
are stored in a db or in AD ?
Nov 14, 2018 10:13 AM|emrulkayes2103|LINK
Thank your for your reply. User information will be stored in Db and want to use Asp.Net OWIN Identity. I have added below line of code after login successfully
protected void CreateCookieForAuthentication(ApplicationUser userDetails, bool isPersistent = false)
var claims = new List<Claim>();
claims.Add(new Claim(ClaimTypes.NameIdentifier, userDetails.Id));
claims.Add(new Claim(ClaimTypes.Name, userDetails.UserName));
var identity = new ClaimsIdentity(claims,DefaultAuthenticationTypes.ApplicationCookie);
AllowRefresh = true,
IsPersistent = isPersistent,
ExpiresUtc = Core.GetServerDatetime().AddMinutes(35000),
IssuedUtc = Core.GetServerDatetime()
But when i am running Second application then got error that IIS Access Denied. unauthorized access?? I have only configure startup.cs file in second application.
Nov 14, 2018 11:55 AM|PatriceSc|LINK
So it is about sharing an authentication cookie accross applications in a domain ? In your CookieAuthenticationOptions you would have CookieDomain=".mydomain.com" to scope the cookie to the whole domain and you'll need to use the same machinekey in all apps
so that it can be decrypted.
Edit: try maybe https://www.hanselman.com/blog/SharingAuthorizationCookiesBetweenASPNET4xAndASPNETCore10.aspx
Nov 15, 2018 03:56 AM|emrulkayes2103|LINK
Thanks for your help. I have added CookieAutheticatioOptions in both project. Suppose my primary project is project A and secondary project is project B. When i have started project A CookieAuthenticationOptions loaded correctly from Startup.cs class but
unfortunately in Project B startup.cs class is not invoked. That means project B is not loading the CookieAuthenticationOptions. I have added Asp.Net Identity later in Project B that's why may b i missed some configuration that's why Startup.cs class is not
invoked. Can you please tell me what will be the possible reason for not invoking Startup.cs class in Project B ?? Thanks why when i am starting project B then that says error : IIS access Denied
Nov 15, 2018 04:59 AM|emrulkayes2103|LINK
I have done that. But now a new problem start agian.
app.UseCookieAuthentication(new CookieAuthenticationOptions ()
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
ExpireTimeSpan = TimeSpan.MaxValue,
LoginPath = new PathString("http://localhost:8864/Home/login"),
CookieName = "cookiename",
CookieDomain = ".localhost",
SlidingExpiration = true
above code is in Project B but LoginPath is not allow to use a url. How can i use Url for Redirection like Forms Authentication ??