wam and the java stack

32
WAM and the Java Stack

Upload: keith

Post on 24-Feb-2016

61 views

Category:

Documents


0 download

DESCRIPTION

WAM and the Java Stack. Disclaimer. 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 Integration Training – Part 1. Outline. Spring Security and Authorization - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: WAM and the Java Stack

WAM and the Java Stack

Page 2: WAM and the Java Stack

Disclaimer

• 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 Integration Training – Part 1

Page 3: WAM and the Java Stack

Outline

• Spring Security and Authorization

• WAM (Web Access Management)• WAM integration w/o Spring Security• WAM integration w/ Spring Security

Page 4: WAM and the Java Stack

Review

• Authentication vs. Authorization• Previously discussed authentication with Spring

Security• Now focus on authorization with Spring Security

Page 5: WAM and the Java Stack

Authorization with Spring Security

• http://static.springsource.org/spring-security/site/features.html– Comprehensive Authorization Services

• HTTP requests authorization (securing urls)• @PreAuthorize annotation

Page 6: WAM and the Java Stack

Protecting Urls

• Example of protecting urls<sec:http security="none" pattern="/errors/accessDenied*"/>

<sec:http> <sec:intercept-url access="hasRole('ROLE_ADMIN')" pattern="/secure/**" /> <sec:intercept-url access="isAuthenticated()" pattern="**" />

<sec:access-denied-handler error-page="/errors/accessDenied" /></sec:http>

Page 7: WAM and the Java Stack

????

• Fine grained authorization<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %><sec:authorize access="hasRole(‘ROLE_CHICKEN')"> Content only visible to users who have the “chicken" authority in their list of GrantedAuthority(s). </sec:authorize><sec:authorize url="/chicken"> Content only visible to users authorized to send requests to the "/chicken" URL. </sec:authorize>

Page 8: WAM and the Java Stack

@PreAuthorize annotation

• Scanning enabled with following element:

• Some examples:

<sec:global-method-security pre-post-annotations="enabled"/>

@PreAuthorize("hasRole('ROLE_ADMIN')") public void create(User newUser);

@PreAuthorize("#user.username == authentication.username") public void doSomething(User user);

Page 9: WAM and the Java Stack

• <lds-account:authorities-populators > </lds-account:authorities-populators> •

Page 10: WAM and the Java Stack

Authorities Populators

• http://code.lds.org/maven-sites/stack/module.html?module=lds-account/stack-lds-account-spring/index.html#Authorities_Populators

• Example<lds-account:authorities-populators include-defaults="false"> <lds-account:member /> <lds-account:workforce /> <lds-account:role name="ROLE_USER" /> <lds-account:custom ref="customAuthoritiesPopulator"/> </lds-account:authorities-populators>

TODO: show example of specifying on a authentication element

Page 11: WAM and the Java Stack

Demo

Page 12: WAM and the Java Stack

WAM (Web Access Management)

Page 13: WAM and the Java Stack

What is WAM?

• WAM stands for Web Access Management• Authentication

– Authentication management– Single Sign-on

• Authorization– Url (course-grained)– Entitlements (fine-grained)

Page 14: WAM and the Java Stack

Architectural Overview of WAM

Page 15: WAM and the Java Stack

Injected Headers

• WAM injected headers:– https://tech.lds.org/wiki/SSO_Injected_Headers

• How the headers map with LDS Account (LDAP) attributes:– https://ldsteams.ldschurch.org/sites/wam/

Implementation%20Details/HTTP%20Headers.aspx• Required headers

– policy-ldsaccountid– policy-cn

Page 16: WAM and the Java Stack

Wamulator

• For complete documentation:– http://tech.lds.org/wiki/WAMulator

• WAM Maven plugin provided to start/stop the wamulator

Page 17: WAM and the Java Stack

Demo

Page 18: WAM and the Java Stack

Stack / WAM integration w/o Spring Security• code.lds.org/maven-sites/stack/module.html?

module=lds-account/stack-lds-account-wam/index.html#Configuration

<filter> <filter-name>wamContextFilter</filter-name> <filter-class>org.lds.stack.wam.filter.WamContextFilter</filter-class> </filter>

<filter-mapping> <filter-name>wamContextFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

Page 19: WAM and the Java Stack

WamContext

• Accessed with:

• WamContexts consists of 3 main parts:– LdsAccountDetails object

– WamRequestProvider

– EntitlementService

WamContextHolder.getWamContext();

WamContextHolder.getWamContext().getLdsAccountDetails().getPreferredName();

WamContextHolder.getWamContext().getWamRequestProvider ().getCookieHeader();

WamContextHolder.getWamContext().getEntitlementService()….

Page 20: WAM and the Java Stack

Demo

Page 21: WAM and the Java Stack

Lab 1

https://tech.lds.org/wiki/WAM_Integration_-_Part_1#Lab_1

Page 22: WAM and the Java Stack

WAM and Spring Security

Page 23: WAM and the Java Stack

Why WAM and Spring Security?

• Spring Security provides– Full featured authorization system– Abstraction to authentication and authorization– Allows for complex fallback authentication systems– Facilitates proxy support

Page 24: WAM and the Java Stack

WAM Spring Security Integration

• Integration point<lds-account:wam ><intercept url TODO…</lds-acount:wam>

<sec:authentication-manager> <sec:authentication-provider ref="ldsAccountAuthenticationProvider" /></sec:authentication-manager>

Page 25: WAM and the Java Stack

Demo

Page 26: WAM and the Java Stack

Spring Security and WAM authorization

• Spring provides programming tools– Full featured EL capabilities– Convenient annotations– Management central to the application

Page 27: WAM and the Java Stack

Spring Security EntryPoint

• Simplifies WAM configuration / management• Utilizes WAM for authentication

– User details injected if authenticated• Allows course grained authorization to be

managed within the application

Page 28: WAM and the Java Stack

Spring Integration

Page 29: WAM and the Java Stack

Demo

Page 30: WAM and the Java Stack

Lab 2

https://tech.lds.org/wiki/WAM_Integration_-_Part_1#Lab_2

Page 31: WAM and the Java Stack

Conclusion

• LDS Account rocks!• The Java Stack integration with LDS Account and

Spring Security rocks!

Page 32: WAM and the Java Stack

Credit Where Credit is Due

• http:// http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html

• Spring Security 3 – by Peter Mularien• http://en.wikipedia.org/wiki/