download report

Transcript LDS_Account_Integration_Training

LDS Account and the Java Stack
• This is a training NOT a presentation.
– Be prepared to learn and participate in labs
• Please ask questions
• Prerequisites:
– Basic Java knowledge
– Basic Spring knowledge
• LDS Account Overview
– History
– Authentication
– User Details
• Spring Security Overview
– Authentication
– LDS Account integration
– In memory integration
• LDS Account Search
• Spring Security and Authorization
• Historically each application handled
authentication as a one off
– Troublesome for users (many credentials to
– User information duplicated over and over
throughout the enterprise
– Difficult to get user information at all
• Screaming for consolidation and a single, central
LDS Account
"LDS Account is a single user name and password
for any person who interacts with online LDS
Church resources. LDS Account is the primary
account authentication credentials for most
Church sites and applications. It reduces
development costs that would be incurred as the
user interfaces change, or as upgrades to security
and the registration process are required. Unlike
previous authentication systems, LDS Account is
a branded single sign-on solution that is centrally
managed at"
LDS Account (cont.)
"LDS Account has become the key to accessing all
the resources the Church has to offer, such as
family history tools, ward and stake websites,
employment resources, and more. ... The idea is
to have only one username and password that
you can use with all password-protected
websites the Church has."
What is LDS Account?
• LDS Account is meant to be the single source for
user authentication and basic user information
• LDS Account is implemented with LDAP
• LDS Account is an application for maintaining
user attributes
LDS Account Uses LDAP
• Lightweight Directory Access Protocol
• Distributed directory of information
– Much like a database
– Not queried with SQL
– For further information about the Directory
structure, please see the corresponding section at:
• LDS Account = LDAP
• WAM = Single Sign-on
User Details
• LDS Account also provides user information
– User details
– User details can be exposed through
• LDAP attributes
• WAM headers
• SAML attributes
LDS Account User Details Integration
• The LDS Account module acts as a Java model for
LDS Account information
• is the abstraction layer
for LDS Account user details integration
• Factories generate LdsAccountDetails object for
each user
– Factories handle the different formats in which the
raw user details attributes are provide to the
• LDAP attributes, WAM headers, SAML, …
Lab 1
LDS Account Spring Security Integration
Authentication vs. Authorization
• Authentication - "you are who you say you are"
– Identification of an individual user of the application
– Credential-based authentication
• Authorization - "you have appropriate
permissions to perform the operation you are
– Availability of functionality and data to users who are
authorized (or allowed) to access it
Spring Security
• Spring Security is a highly customizable and
pluggable enterprise authentication / authorization
security framework
– Provides tools for managing application access
– Rules for what users can access (by url) (authorization)
– Securing methods (authorization), ...
• Overcomes lack of depth in J2EE Servlet
• Further information can be found here:
Spring Security (authentication)
• Spring comes with many pluggable
authentication providers
– Support provided for authenticating with:
X.509 (Certificates)
Databases (JDBC)
Spring Security Authentication Manager
• Basic configuration:
<sec:authentication-provider ref="someAuthenticationProvider"/>
<bean id="someAuthenticationProvider" class="">
• Native Spring in memory authentication provider
configuration (applicationContext.xml)
<sec:user name="billy" password="billyspassword" authorities="ROLE_USER, ROLE_ADMIN" />
<sec:user name="bob" password="bobspassword" authorities="ROLE_USER" />
Spring Security Web Configuration
• Configure filter in web.xml
Spring Security Context Configuration
• Configure applicationContext.xml
<sec:http security="none" pattern="/login.jsp*" />
<sec:http security="none" pattern="/errors/**" />
<sec:access-denied-handler error-page="/errors/accessDenied" />
<sec:intercept-url pattern="/**" access="ROLE_ADMIN" />
<sec:form-login />
<sec:logout invalidate-session="true“ />
• Please see documentation for further element and
attribute information:
Spring Security/LDS Account Integration
• LDS Account authentication provider hooks into
Spring Security
• In-memory implementation
• Namespace handlers simplify the configuration
Spring Security/In-memory Authentication
• In-memory authentication provides quick setup
• Useful for testing
• Attribute information:
Access LdsAccountDetails
• Through injection
private Provider<LdsAccountDetails> ldsAccountDetails;
public void someMethod() {
//not the get() is a call on the provider to grab the current instance
String preferredName = ldsAccountDetails.get().getPreferredName();
• Through static lookup
LdsAccountDetails ldsAccountDetails = ((LdsAccountUser)
String preferredName = ldsAccountDetails.getPreferredName();
Lab 2
LDS Account (LDAP) Search
LDS Account Search Configuration /
• Configuration
<lds-account:ldap-server url="ldaps://"
manager-dn="cn=XXXXX,ou=apps,o=lds" manager-password="XXXXX"/>
<lds-account:ldap-search />
• Usage
private LdsAccountSearch ldsAccountSearch;
public List<LdsAccountDetails> findLdapUsers(String cnValue, String snValue) {
SearchClause.equals(LdsAccountAttributes.USERNAME, cnValue + "*"),
SearchClause.equals(LdsAccountAttributes.SUR_NAME, snValue + "*")
LDS Account Usage
• Searching format
Native LDAP search query: (|(cn={0}*)(sn={1}*))
Abstracted search query:
SearchClause.equals("cn", value + "*"),
SearchClause.equals("sn", value + "*")
• For more info:
Authorization with Spring Security
• Authentication vs. Authorization
• Previously discussed authentication with Spring
• Now focus on authorization with Spring Security
Authorization with Spring Security
• Comprehensive Authorization Services
• HTTP requests authorization (securing urls)
• @PreAuthorize annotation
• Granted authorities
Protecting Urls
• Example of protecting urls
<sec:http security="none" pattern="/errors/accessDenied*"/>
<sec:intercept-url access="hasRole('ROLE_ADMIN')" pattern="/secure/**" />
<sec:intercept-url access="isAuthenticated()" pattern="**" />
<sec:access-denied-handler error-page="/errors/accessDenied" />
Authorize Tag
• Fine grained authorization
<%@ taglib prefix="sec" uri="" %>
<sec:authorize access="hasRole('ROLE_ADMIN')">
Content only visible to users who have the "admin" authority in their list of GrantedAuthority(s).
<sec:authorize url="/secure">
Content only visible to users authorized to send requests to the "/secure" URL.
@PreAuthorize annotation
• Scanning enabled with following element:
<sec:global-method-security pre-post-annotations="enabled"/>
• Some examples:
public void create(User newUser);
@PreAuthorize("#user.username == principal.username")
public void doSomething(User user);
Authorities Populators
• MemberAuthoritiesPopulator
– Adds ROLE_MEMBER authority if a member
• WorkforceAuthoritiesPopulator
– Adds ROLE_WORKFORCE authority if currently a
Church employee
• PositionsV2AuthoritiesPopulator
– Adds a granted authority for each position held
• Position name prepended with ROLE_
Authorities Populators
• Example
<lds-account:authorities-populators id="authoritiesPopulators" include-defaults="false">
<lds-account:member />
<lds-account:workforce />
<lds-account:role name="ROLE_USER" />
<lds-account:ldap authorities-populators-ref="authoritiesPopulators" />
• LDS Account rocks!
• The Java Stack integration with LDS Account and
Spring Security rocks!
Credit Where Credit is Due
• http://
• Spring Security 3 – by Peter Mularien