Announcement Announcement Module
Collapse
No announcement yet.
Spring Web flow Project that is using CAS for Authentication, Spring Security LDAP Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Web flow Project that is using CAS for Authentication, Spring Security LDAP

    I am working on a Spring Web flow Project that is using CAS for Authentication, plus single-sign-on and Spring Security Access LDAP for Authorities.

    My firm is now rethinking the Architecture and talking about adding more user data to LDAP, Right now we have some of the user data in mySQL with the project data.

    Example.. User Signs in with email and password, CAS using LDAP searches for the user and signs the user in then Spring Security checks LDAP for Authorities. So now we are signed in to the project and have the email address as the user id but most of the systems we have use a key called profile_id. So the first step of my projects is to do a search for the profile_id using the email as a key into MySQL.

    Below is the code I use to get the user id which is the email address. How hard would it be to change the code to do a search of LDIF and get the profile_ID and add it to the securityContextHolder some how??


    Code:
    String getUser() {
        
        		String username;
        
        		LOGGER.debug("getAuthentication().getName():"
        				+ SecurityContextHolder.getContext().getAuthentication()
        						.getName());
        
        		Object obj = SecurityContextHolder.getContext().getAuthentication()
        				.getPrincipal();
        
        		if (obj instanceof UserDetails) {
        			username = ((UserDetails) obj).getUsername();
        		} else {
        			username = obj.toString();
        		}
        		LOGGER.debug("getUser:" + username);
        
        		return username;
        	}
Working...
X