« Return to Thread: Re: cas-dev Digest, Vol 42, Issue 2
Hello Mark, Thanks for your reply. I was successful in creating a simple .net application using IIS. And I did almost all the changes mentioned in http://www.ja-sig.org/wiki/display/CASC/.Net+Cas+Client (mentioned in Browser Based Authentication)except I couldnot understand where should (in while file) i should make the following changes(mentioned in Proxy Based Authentication) . Could someone please let me know.
Proxy Based Authentication To continue the examples, imagine you have a web service which returns user details pulled from a database and keyed on a userid. You could have the web service take 2 parameters - a user name and a password - but that would mean that you would have to pass user credentials around. Hitting your web service via SSL would be an improvement, but still far from ideal. A better solution would be to take one parameter - a proxy ticket generated by CAS. You could then use this CAS client to get the user name in the following way: ... using DotNetCASClient; ... [WebMethod] public String GetUserName(String ticket) { //The first argument in the constructor is the service against which you trying to validate //The second argument is the proxy validation URL for your CAS server DotNetCASClientProxyValidate client = new DotNetCASClientProxyValidate("http://myawesomeservice.uwe.ac.uk", "https://casserver.uwe.ac.uk/cas/proxyValidate"); String userid = client.Authenticate(ticket); return userid; } ... Obviously, you would want to then use the username to retrieve details from the database and return them as well. If the authentication fails then the returned user will be 'failed'. The DotNetCASClientProxyValidate class also has a GetCASXML method which also takes the ticket as a String. This performs the same authentication process that the Authenticate() method does but, instead of returning an user name, it returns the full XML that CAS returned - for example: <cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas"> <cas:authenticationSuccess> <cas:user>testUserName</cas:user> <cas:proxies> <cas:proxy>https://myawesomecasproxyplace/cas/pgtURL.asp</cas:proxy> </cas:proxies> </cas:authenticationSuccess> </cas:serviceResponse> This particularly useful if you want to access more data than just the user name - especially if your CAS is configured to return other user information as well.
Regards, Meghana
From: Mark Rogers <mark_rogers@...> |
« Return to Thread: Re: cas-dev Digest, Vol 42, Issue 2
| Free Forum Powered by Nabble | Forum Help |