[cas-dev] DotNetCasClient, getting access to more service response properties

139 views
Skip to first unread message

Elijah W. Gagne

unread,
Sep 9, 2012, 5:15:33 PM9/9/12
to cas...@lists.jasig.org

Hi All,

 

I've modified DotNetCasClient so that User.Identity.Name is set cas:netid (custom property) instead of cas:user. This solved a problem for me because cas:user at Dartmouth is based on a person's name. As a result, if your name changed then an app based on DotNetCasClient would see you as a new user. cas:netid at Dartmouth is unique and guaranteed to never change for someone.

 

Now my updated version of DotNetCasClient sets User.Identity.Name from the cas:netid. This is great, except that there is additional data in the cas:serviceResponse that I'd like to utilize. For instance, I'd like to use cas:name. I tried out setting User.Identity.Name = cas:netid + "|" + cas:name. That worked well for gaining access to both the username and displayname for a person. However, because my app's UserProfile table is setup such that username = netid (not cas:netid + "|" + cas:name), the built in function Roles.IsUserInRole() function no longer works.

 

I could get the DisplayName of a person at logon time by doing an LDAP query, but that is ugly. Is there a simple way to get access to other cas:serviceResponse properties?

 

Thanks!

-EWG

 

Elijah W. Gagne | e...@dartmouth.edu | W: 603.646.9650 | C: 518.321.6611

Infrastructure Applications Administrator | Dartmouth College | Hanover, NH 03755

 

-- 
You are currently subscribed to cas...@lists.jasig.org as: jasig-cas-dev+...@googlegroups.com
To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-dev

Marvin Addison

unread,
Sep 10, 2012, 10:35:53 AM9/10/12
to cas...@lists.jasig.org
> I could get the DisplayName of a person at logon time by doing an LDAP
> query, but that is ugly. Is there a simple way to get access to other
> cas:serviceResponse properties?

Yes, via CasAuthentication.CurrentPrincipal.Assertion.Attributes. [1,
2] I'm embarrassed that this is so poorly documented. We demonstrate
a number of features of the client in the ExampleWebApp distributed
with source, but that important feature is missing. I'd be happy to
work on adding a source example if you'd open a Jira issue and assign
to me.

Thanks,
M

[1] https://github.com/Jasig/dotnet-cas-client/blob/master/DotNetCasClient/Security/CasPrincipal.cs
[2] https://github.com/Jasig/dotnet-cas-client/blob/master/DotNetCasClient/Security/Assertion.cs
Reply all
Reply to author
Forward
0 new messages