TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
developer massaka
NA
2
1.1k
Logging out after a few minutes despite authentication in Owin
Nov 1 2020 3:04 AM
I use owin and although I have set the expired time defined in Startup.cs as 1 day, it exits itself after 15 minutes when the site is open in browser.Besides, when I run it on my localhost, I do not encounter such a problem.When I right click and look at the cookies in the applications, the expires actually looks correct.application />cookies
app.UseCookieAuthentication(
new
CookieAuthenticationOptions
{
ReturnUrlParameter = CookieAuthenticationDefaults.ReturnUrlParameter,
ExpireTimeSpan = TimeSpan.FromDays(1),
SlidingExpiration =
true
,
CookieHttpOnly =
true
,
AuthenticationType =
"Cookie"
,
LoginPath =
new
PathString(
"/Admin/Login"
),
Provider =
new
CookieAuthenticationProvider
{
OnResponseSignIn = context =>
{
context.Properties.AllowRefresh =
true
;
context.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddDays(1);
}
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
My sign in function is as follows,
var claims =
new
Claim[]
{
new
Claim(ClaimTypes.NameIdentifier,model.id),
new
Claim(ClaimTypes.Name,model.username),
new
Claim(ClaimTypes.Role,
"Admin"
)
};
var identity =
new
ClaimsIdentity(claims,
"Cookie"
);
Authentication.SignIn(
new
AuthenticationProperties() { ExpiresUtc = DateTime.UtcNow.AddDays(1), IsPersistent =
true
}, identity);
Reply
Answers (
0
)
I am having problems accessing classes in subfolders
Error while connection .net core api to sql server