forms-authentication

What is a very simple authentication scheme for Sinatra/Rack

大憨熊 提交于 2019-12-02 13:56:59
I am busy porting a very small web app from ASP.NET MVC 2 to Ruby/Sinatra. In the MVC app, FormsAuthentication.SetAuthCookie was being used to set a persistent cookie when the users login was validated correctly against the database. I was wondering what the equivalent of Forms Authentication would be in Sinatra? All the authentication frameworks seem very bulky and not really what I'm looking for. Here is a very simple authentication scheme for Sinatra. I’ll explain how it works below. class App < Sinatra::Base set :sessions => true register do def auth (type) condition do redirect "/login"

Request.IsAuthenticated always returning false

笑着哭i 提交于 2019-12-02 12:59:51
问题 I am working on adding login functionality to a site I am building, but after login, the Request.IsAuthenticated property always returns true. I have searched this error and have found the same answers over and over, but those solutions are not working for me. Code from AccountController::Login action: if (response.Status == KD.Core.Enumerations.LoginStatus.LoggedIn) { FormsAuthentication.SetAuthCookie(model.Username, model.RememberMe); SessionMgr.GetInstance().SetSessionValue(SessionTypes

.NET 2.0 Web App Authentication Failing: “The ticket supplied was invalid”

岁酱吖の 提交于 2019-12-02 12:38:28
问题 I have a .NET 4.0 application with a 2.0 application as a child. The web applications are not in a multi-server environment; only one server is involved in serving these requests. Both applications are using custom authentication and both applications have the same machineKey attributes and values. When I visit the 2.0 application the event log is showing the following message: Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied was invalid

ASP.NET Authentication

白昼怎懂夜的黑 提交于 2019-12-02 12:26:49
问题 I have the following a login page where the user enters in their username and password. With that info, I need to then make sure that they are part of the Admin1 role If so, I like to set a cookie on the user's machine. With the code I have below User.InRole it doesn't enter into the if statement. If I uncomment the FormsAuthentication.SetAuthCookie(txtUserName.Text, true); above it works. Meaning shouldn't I set the cookie only if the user is part of Admin1 role I have the following but does

Auth login with email or mobile Cakephp

*爱你&永不变心* 提交于 2019-12-02 12:18:57
I am working on cakephp 2.x.i have a table in my database name user and it has 4 fields id, email, password and mobileNo i have two fields in my login.ctp <?php echo $this->form->create(); echo $this->form->input('email'); echo $this->form->input('password'); echo $this->form->end('submit'); ?> what i want is i want to login the user from his mobileNo too(if he typed mobile number rather then email address) just like facebook has done ..he can either login with hi email address or mobileno .i dont want to create another input field.. i dont know how can i do this here is my code AppController

IIS, denying access to static files; What is wrong with this example?

女生的网名这么多〃 提交于 2019-12-02 11:14:04
问题 I am trying to get the simplest example of allowing access by default, denying access unless authenticated to specific directories in IIS, to work. When you Google around, everyone says it's as simple as this: <location path="~/pages"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> Somehow it hasn't been for me. Here's the project structure: Here's the Web.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <authentication

IIS, denying access to static files; What is wrong with this example?

China☆狼群 提交于 2019-12-02 07:38:41
I am trying to get the simplest example of allowing access by default, denying access unless authenticated to specific directories in IIS, to work. When you Google around, everyone says it's as simple as this: <location path="~/pages"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> Somehow it hasn't been for me. Here's the project structure: Here's the Web.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <authentication mode="Forms"> <forms loginUrl="~/" /> </authentication> <authorization> <!--<deny users="*"/>--> <

ASP.NET mvc auth or session expires quicker than set

跟風遠走 提交于 2019-12-02 06:53:00
In my ASP.NET MVC5 website the login and session timeout in web.config are as follows: <system.web> <authentication mode="Forms"> <forms loginUrl="~/Account/Login" slidingExpiration="true" timeout="60"/> </authentication> <sessionState mode="InProc" timeout="60"/> </system.web> Still the session or authentication times our in five minutes. I have approached my web hosting provide to increase the timeout in IIS and they shared a screenshot after increasing the timeout in IIS, but nothing changed. Any idea why this is happening. Tetsuya Yamamoto First of all, try setting session timeout on

.NET 2.0 Web App Authentication Failing: “The ticket supplied was invalid”

喜欢而已 提交于 2019-12-02 04:37:55
I have a .NET 4.0 application with a 2.0 application as a child. The web applications are not in a multi-server environment; only one server is involved in serving these requests. Both applications are using custom authentication and both applications have the same machineKey attributes and values. When I visit the 2.0 application the event log is showing the following message: Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied was invalid. Event time: 12/2/2011 11:36:49 AM Event time (UTC): 12/2/2011 5:36:49 PM Event ID:

Request.IsAuthenticated always returning false

雨燕双飞 提交于 2019-12-02 04:33:25
I am working on adding login functionality to a site I am building, but after login, the Request.IsAuthenticated property always returns true. I have searched this error and have found the same answers over and over, but those solutions are not working for me. Code from AccountController::Login action: if (response.Status == KD.Core.Enumerations.LoginStatus.LoggedIn) { FormsAuthentication.SetAuthCookie(model.Username, model.RememberMe); SessionMgr.GetInstance().SetSessionValue(SessionTypes.UserId, response.UserId); //Have added logging here to ensure login is successful in prod. return