views:

83

answers:

2

Right now we have AD/Exchange to manage all of our users logins/e-mail on-site at the office. The major app that everyone uses maintains its own login accounts and all users have a tendency to forget login information for at least one of the two logins.

What I'm considering doing is using AD to authenticate the user in the application so that they don't even have to login to the app after they've logged into their machine.

The problem is that there are small number of users that work off-site (the app can work over the internet) and just use the machine's local account (which is causing problems of its own).

What I'm wondering is, will using AD to authenticate users on-site still be an option if a user works off-site?

+1  A: 

The answer to almost any question posed to a programmer is "Yes..." It's what comes after the ellipses that is important. You may not want to do the things that come after the ellipses.

Based on the information in your question I think the answer is "No" but there are several scenarios where we could change that to a "yes".

If the AD account is only being used to authenticate that a user knows the password, then you could make a web service, host it in your domain, set it up to use windows authentication and SSL, modify the application to prompt the user for credentials, and call a method in the web service using those credentials. In that scenario, a successful call to the web service means that the user is authenticated. You could use the user's credentials to continue from there.

Detecting weather the application needs to prompt the user for credentials or not could be done by attempting to call the web service with the user's logged in credentials first. If this call fails then you know you need to prompt the user.

Not knowing the rest of the details of your application however means that there are many scenarios where this would not be enough.

I have done something very similar to what I described above. My scenario was the reverse: the application worked over the internet but I wanted it to be easier to log in in the cases where the machine has domain membership.

As an aside, the members who work from home: are they using laptops that are part of the domain or are they using machines that are not connected? In this case you may be able to use cached credentials but you should ask that question over at ServerFault.

Oplopanax
They actually take their desktop workstations (which are setup to run on the domain) home and work full-time from their residence. Currently they use their credentials cached on the machine - but this only happened by coincidence (the business people were the ones that said 'Sure you can work from home! Everything will be fine!'
SnOrfus
Those cached credentials will eventually expire; I think they will always be able to log in locally, but to use those credentials to access network resources will occasionally require re-authentication with the domain.Like I mentioned, you should search ServerFault.com for information regarding the AD issue. As a side note, there's no reason to make something as complicated as a web service you could even just create a regular HTML page and protect it with Windows Authentication.
Oplopanax
+1  A: 

Yes, you can definitely do that. It'll be a bit of work though.

What your app would have to do is either find out automagically whether it's directly connected to the office LAN, or working away from the office. Or you could have the user tell you, of course :-)

If it's on the LAN, no problem - you authenticate against AD.

If it's away from the office, you could e.g. call a WCF service on the company LAN, pass your Windows credentials, and have it authenticate you against the company AD. If you provide the right set of credentials, you'll be authenticated and allowed to work - if you're not allowed to log in, the call to the WCF service would fail.

You could do this almost automatically by using Windows credentials - in which case the "remote" user would still have to log on to your domain and use his / her normal Windows credentials; or you can pass username/password over the wire to WCF, or even install a certificate on the remote user's machine that WCF will then map to an AD account on the server side.

The options are plentiful! :-)

Marc

marc_s