Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

SSL support for Login
meigs
#1 Posted : Saturday, 22 March 2008 10:44:47 AM(UTC)
Rank: Advanced Member

Joined: 16/03/2008(UTC)
Posts: 86
Man
Location: Pennsylvania

would it be possible to set a switch in the config file to force the login.aspx file to https: to support secure login for where SSL is enabled?

thanks.
Roger Martin
#2 Posted : Sunday, 23 March 2008 2:11:32 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

You may be able to do this already just by altering the URL for the login page in web.config. Look for this section:

Code:
<authentication mode="Forms">
    <forms loginUrl="login.aspx" defaultUrl="default.aspx" protection="All" timeout="129600" slidingExpiration="true"/>
</authentication>


and change it to this:

Code:
<authentication mode="Forms">
    <forms loginUrl="https://www.yourdomain.com/gallery/login.aspx" defaultUrl="default.aspx" protection="All" timeout="129600" slidingExpiration="true"/>
</authentication>


You need to edit the URL for your server and enable SSL for the containing directory in IIS Manager.

You may find this doesn't work because Gallery Server uses relative redirects within its code. This can probably be solved by isolating the login.aspx page in its own directory in future versions of GS. Let me know what you find and I'll consider refactoring this if necessary.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
meigs
#3 Posted : Monday, 1 September 2008 7:43:41 AM(UTC)
Rank: Advanced Member

Joined: 16/03/2008(UTC)
Posts: 86
Man
Location: Pennsylvania

Hi, justing getting back to this after installing 2.1 on a server with SSL.

I tried the following code change in the config as suggested. I had set the site to force a login. To address that I put the login.aspx form in the /anon/ subdirectory which allows everyone to read. I hard wired in both the https and the http return as below. I actually got the site to login fine however the page would redirect back to the main menu page. Although the user was logged in it keep showing the login screen. If I hit the "All Albums" menu at the top of the page I could get into the site and bypass the login.

<authentication mode="Forms">
<forms loginUrl="https://www.yourdomain.com/anon/login.aspx" defaultUrl="http://www.yourdomain.com/default.aspx" protection="All" timeout="129600" slidingExpiration="true"/>
</authentication>

Any other thoughts would be great. I really only need SSL for the initial login page.

Thanks.!
Roger Martin
#4 Posted : Monday, 1 September 2008 7:52:00 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

I am confused. Are you saying that, after logging in, you are redirected to the home page, but the login controls at the top right are still showing?
Roger Martin
Creator and Lead Developer of Gallery Server Pro
meigs
#5 Posted : Monday, 1 September 2008 8:17:41 AM(UTC)
Rank: Advanced Member

Joined: 16/03/2008(UTC)
Posts: 86
Man
Location: Pennsylvania

When I set in the config file:

<authorization>
<deny users="?" />
</authorization>

it forces a login page to be displayed in the center of the page. When I enter the login information the user is logged in the "All Albums" menu shows up on the top etc hower the login page continues to be displayed. The return URL string is here:

/login.aspx?ReturnUrl=%2fgsp%2fDefault.aspx

and points to the right relative location (I have the site installed in /gsp/ virtual directory).

Roger Martin
#6 Posted : Monday, 1 September 2008 9:25:54 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

When you log in the first time, you are at login.aspx, right? And after you enter your username and pwd, you end up *back* at login.aspx? Am I understanding this correctly?

I am not sure I am going to be able to solve this one without getting a certificate and digging in, but at least I would like to understand what is happening.

Roger Martin
Creator and Lead Developer of Gallery Server Pro
Ranny
#7 Posted : Sunday, 6 December 2009 9:04:35 AM(UTC)
Ranny

Rank: Member

Joined: 3/12/2009(UTC)
Posts: 11
Location: USA

I tried adding loginUrl="https://www.mydomain.com/gallery/login.aspx" to the web.config and the login page appeared still using http:. Now the GSP app works if we go ahead and enter https://www.mydomain.com/gallery when connecting. I do not know of the SSL slows down the file retrieval however. I think that we want to use SSL for the login page to protect our AD passwords and then have it switch back to http: otherwise.
When we select "require SSL" for the IIS Authentication then we get this error if we attempt using http:.
System.Web.HttpException
The application is configured to issue secure cookies. These cookies require the browser to issue the request over SSL (https protocol). However, the current request is not over SSL.

On another site we did edit the 403.4 error page to execute this URL and that works for that site. Still the https: stays active for all of the subsequent request and does not go back to http:.
<!-- beginning of HttpsRedirect.htm file -->
<script type="text/javascript">
function redirectToHttps()
{
var httpURL = window.location.hostname + window.location.pathname;
var httpsURL = "https://" + httpURL ;
window.location = httpsURL ;
}
redirectToHttps();
</script>
<!-- end of HttpsRedirect.htm file -->

This method does not work for us on this GSP app and instead we still get this error:
Exception Type System.Web.HttpException
Message The application is configured to issue secure cookies. These cookies require the browser to issue the request over SSL (https protocol). However, the current request is not over SSL.
Source System.Web
Target Site Void SetAuthCookie(System.String, Boolean, System.String)
Stack Trace at System.Web.Security.FormsAuthentication.SetAuthCookie(String userName, Boolean createPersistentCookie, String strCookiePath)
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Roger Martin
#8 Posted : Monday, 7 December 2009 11:29:43 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

GSP does not have built-in support for showing the login page under SSL but not the rest of the gallery. That is something I plan to add, but it is not imminent.

Until then, these are your choices:

1. Do without SSL.
2. Use SSL for the whole app.
3. Build your own logon page that *does* use SSL. This will require customizing the source code.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
Gootynz
#9 Posted : Saturday, 26 December 2009 2:42:52 PM(UTC)
Rank: Member

Joined: 26/12/2009(UTC)
Posts: 6
Man
Location: Aussie

Not sure if this will help, But you can as I undystand it add the following to web.config
I used the following to direct all traffic to https://secure.domain.com and appears to work fine.
<rewrite>
<rules>
<rule name="NON WWW to SECURE redirect" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain.com$" />
</conditions>
<action type="Redirect" url="https://secure.domain.com/{R:0}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="WWW to SECURE redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="www.domain.com" />
</conditions>
<action type="Redirect" url="https://secure.domain.com/{R:0}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="HTTP to HTTPS redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
Rss Feed  Atom Feed
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.