473,378 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how to pass authorization to another application

I wish to create an application that will be spawned within a host web
application after the container app has authorized a user. These two
apps are seperately developed/maintained, and can only share
information via the normal methods (post/get, cookies, etc...). What
is the best and most secure way to pass authorization to the spawned
application?

Aug 2 '06 #1
6 2106
ta***********@gmail.com wrote:
I wish to create an application that will be spawned within a host web
application after the container app has authorized a user. These two
apps are seperately developed/maintained, and can only share
information via the normal methods (post/get, cookies, etc...). What
is the best and most secure way to pass authorization to the spawned
application?
So you basically have two applications/websites and you want to
authenticate a login?

If they are hosted on the same server, simply connect to the same database.

If not, have a validater on the authentication app. This receives the
username and and password, then returns either if it's valid or not.
Note that the validater would never give out hashes or usernames -- it
just tells you if something is correct.

Carl
Aug 3 '06 #2
They are not on the same server. There is no shared internal method of
communicating, so they can only interact via get/post, and cookies.
The host application will authenticate the user, and then it needs to
pass the username and something that proves they've been authenticated
by the host app to my sub-app.

Aug 3 '06 #3
Taylor wrote:
They are not on the same server. There is no shared internal method of
communicating, so they can only interact via get/post, and cookies.
The host application will authenticate the user, and then it needs to
pass the username and something that proves they've been authenticated
by the host app to my sub-app.
You have a problem then. Web server authentication (i.e. through
..htaccess, etc.) is on a per-site basis. Your browser will not send
authentication information from one server to another.

Cookies are the same way - the browser will not under normal conditions
pass a cookie meant for one host on to another. Either one would be a
severe security hole.

However, if the second server is a subdomain, you can use the domain
parameter of setcookie() to specify the cookie will be available to all
subdomains. See the PHP doc for setcookie() for more information.

However - warning. You should NOT rely on cookies for authentication.
It's too easy for someone to edit the cookie (since it is sent to their
machine) and authorize themselves - bypassing all of your security.

Perhaps another way (although I haven't tried) is to create a proxy on
the first server and have it authenticate then pass on the request to
the second one. The second server could then be set to completely block
requests coming from other than the first server.

Not easy, but more secure.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 3 '06 #4
Taylor wrote:
They are not on the same server. There is no shared internal method of
communicating, so they can only interact via get/post, and cookies.
The host application will authenticate the user, and then it needs to
pass the username and something that proves they've been authenticated
by the host app to my sub-app.
The best solution depends on how the user moves from site to the other,
whether HTTPS is involved and whether they have same FQDN. But lets take
the simplest case - where there is none of that:

on server A:

function getToken($username, $encryption_key)
{
$token=base64_encode(encrypt($username . "|" . time()));
return($token);
}

and add the token into the URL you are linking with or as a hidden field in
any forms being submitted to the other server. The at the other end:

function check_auth($token, $encryption_key)
{
$token=base64_decode($token);
$token=decrypt($token);
list($username, $timestamp)=explode('|',$token);
if (abs(time()-$timestamp)>60) { // more than 60 seconds apart
return(false);
} else {
return($username);
}
}

Obviously this is not going to prevent replay attacks - really you should be
using a challenge based mechanism.

The most efficient solution is to push the encryption and validation down to
the transport layer using a VPN though.

C.
Aug 3 '06 #5
Hmmm, I think we're all on different pages, but I think Colin came
closest to what I'm getting at. I think I found a solution:

This sub-site (like I've said, it can share no special links with the
other site like VPN, database, common server, etc...) is designed to be
invoked from many different "host" sites, as a sort of "service" built
into other website. The sub-site is hosted on an entirely different
platform, and must be invoked by get/post, unless there is some other
clever idea.

My solution is to have a secret key for each "host" site that uses my
sub-site service. When the host site authenticates a user, the host
site invokes the sub-site with a query string of an md5 hash of the
concatenation of the secret key and the user's username, along with an
unencrypted version of the username (so I know who's authenticated).
The sub site then checks to make sure the md5 hash matches what is
expected.

What do you think?

Colin McKinnon wrote:
Taylor wrote:
They are not on the same server. There is no shared internal method of
communicating, so they can only interact via get/post, and cookies.
The host application will authenticate the user, and then it needs to
pass the username and something that proves they've been authenticated
by the host app to my sub-app.

The best solution depends on how the user moves from site to the other,
whether HTTPS is involved and whether they have same FQDN. But lets take
the simplest case - where there is none of that:

on server A:

function getToken($username, $encryption_key)
{
$token=base64_encode(encrypt($username . "|" . time()));
return($token);
}

and add the token into the URL you are linking with or as a hidden field in
any forms being submitted to the other server. The at the other end:

function check_auth($token, $encryption_key)
{
$token=base64_decode($token);
$token=decrypt($token);
list($username, $timestamp)=explode('|',$token);
if (abs(time()-$timestamp)>60) { // more than 60 seconds apart
return(false);
} else {
return($username);
}
}

Obviously this is not going to prevent replay attacks - really you should be
using a challenge based mechanism.

The most efficient solution is to push the encryption and validation down to
the transport layer using a VPN though.

C.
Aug 4 '06 #6
Taylor wrote:
Hmmm, I think we're all on different pages, but I think Colin came
closest to what I'm getting at. I think I found a solution:

This sub-site (like I've said, it can share no special links with the
other site like VPN, database, common server, etc...) is designed to be
invoked from many different "host" sites, as a sort of "service" built
into other website. The sub-site is hosted on an entirely different
platform, and must be invoked by get/post, unless there is some other
clever idea.

My solution is to have a secret key for each "host" site that uses my
sub-site service. When the host site authenticates a user, the host
site invokes the sub-site with a query string of an md5 hash of the
concatenation of the secret key and the user's username, along with an
unencrypted version of the username (so I know who's authenticated).
The sub site then checks to make sure the md5 hash matches what is
expected.

What do you think?
I've done something like this in the past with a similar solution.

Host:
Authenticates user (normal db way) then when user whats to go to
sub-site the link is via a submitted form with a hidden field containing:

urlencode(rc4($rc4key,randomjunk().'|CODE|'.random junk().'|'.$username.'|'.gmdate('U')))
Sub-site:
validate page (linked to from Host) can then:

list($junk1,$codeword,$junk2,$username,$time)=expl ode('|',rc4($rc4key,urldecode($_POST['data'])))

then check $codeword=='CODE' (checks right rc4key was used)
and check $time within 60 secs (prevents replay attacks after a minute)
where rc4() is a RC4 (de)encryption function (doh!),
$rc4key is a big shared key, and
randomjunk() produces a random length string of random characters
(excluding '|')
Someone with more cryptography knowledge can now say which is the most
secure solution (or point out some major flaw in our processes).

Robin
Aug 4 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: phreeskier | last post by:
i want to implement authorization with windows authentication and don't have the slightest clue of how to do this implementation. the basic windows authentication for this .NET application is...
15
by: Shaun Wilde | last post by:
I am not sure if this is a .NET bug/feature and IIS5 one or a combination of the 2 so here goes I have a situation where when I call an ASP.NET webservice running under windows 2000 (I assume...
9
by: Bijoy Naick | last post by:
I've implemented forms authentication and authorization on my application. In my Web.Config, my authorization section looks like this.. <authorization> <allow roles="admin" /> <deny users="*"...
2
by: Water Cooler v2 | last post by:
Is the authorization tag/class in web.config\<system.web> available only for Windows authorization? Does it make sense for Forms based authentication?
5
by: | last post by:
When completing certain types of transactions, the users of my app will need to have the clients sign an authorization form. I want to add a button to the page that allows them to print the auth...
1
by: sonu | last post by:
Mark is creating a website using ASP.NET. He is using Forms authentication for authenticating and authorizing users. He has the following layout of files and directories in his website: Root...
1
by: gilly3 | last post by:
I'd like to use a master page for (nearly) every page in my ASP.NET 2.0 website. I also have some webpages that I'd like to protect by using forms authorization. I have a page that requires...
14
by: tshad | last post by:
I am trying to set up an intranet at work that will use our Active directory to authorize our users. We also want them to access the site from the outside (such as at home) and also be...
2
by: Mike Placentra II | last post by:
Hi. When using Server.Transfer() to switch the request to a specific web form (as opposed to a class implementing IHttpHandler, if it makes any difference), do I have to do something special to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.