welcome to spring forward 2006 · • file system • x.509 ... – spring 2.0 rc4 – acegi...

36
www.springforward2006.com September 26, 2006 Penn State Great Valley Welcome to Welcome to Spring Forward 2006 Spring Forward 2006

Upload: others

Post on 14-Oct-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Welcome toWelcome toSpring Forward 2006Spring Forward 2006

Page 2: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Scott BattagliaApplication DeveloperEnterprise Middleware

Rutgers University

Dmitriy KopylenkoApplication Developer

Architecture & FrameworkRutgers University

Securing Your Applications with CAS and Acegi

Page 3: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Overall Presentation Goal

Learn How to Use Acegi Security and CAS to secure your Spring-based

Applications

Page 4: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Qualifications

• Dmitriy Kopylenko– Senior Architect on Architecture & Framework Team– Committer to various open source projects including

Spring and Acegi

• Scott Battaglia– Application Developer for Enterprise Middleware– Lead Developer/Architect for JA-SIG CAS– Committer for Acegi Security

Page 5: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Presentation Overview

• Why Use Acegi Security?• Why use JA-SIG CAS?• Adding Acegi and CAS to YOUR

Application• How Acegi Works• How CAS Works• Rutgers Experience with Acegi/CAS• Conclusion

Page 6: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Why Use Acegi Security?

Page 7: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Acegi Overview

• Official Spring Project• Used in projects for over 2 ½ years now• Over 70,000 downloads before 1.0 release• High test coverage• 14 active committers• Apache 2.0 licensed

Page 8: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Authentication Features

• LDAP• BASIC• Digest• JAAS• CAS• X.509 Certificates• DAO• Run-as Replacement• Form-based login• Anonymous

•Remember-Me•SiteMinder•HTTP Switch User•Concurrent User Limiting•Container Adapters

•JBoss•Jetty•Tomcat•Resin

•Write your own•Decide at deployment

Page 9: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Authorization Features

• Web requests– Http://my.server.com/some/secure/path

• Java methods– AspectJ compile-time weaving– Spring AOP runtime weaving

• Domain object instance security• Write your own• All with authentication independence!

Page 10: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Other Features

• Localization• Channel security (HTTPS)• Human user detection (JCAPTCHA)• Filter to bean proxy capabilities• Tag libraries

– JSP and Velocity• Two sample applications• Quality documentation

Page 11: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Technical Design

• Uses Spring IoC container– DI, events, localization and JdbcTemplate

• Completely interface-driven• High cohesion, loosely coupled• Encourage customization and extension• Java 1.3+ compatible

– Java 5 code packaged in “Tiger” JAR

Page 12: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Why Use JA-SIG CAS?

Page 13: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

CAS Overview

• Official JA-SIG Project• Used in production for over a year• High test coverage• 8 active committers• JA-SIG License

Page 14: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Authentication Features

• LDAP• DAO• NTLM (3.1)• SPNEGO (3.1)• RADIUS (3.1)• File System• X.509

• “Trusted”• JAAS• Acegi• Create your own…• Chain them

together

Page 15: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Other Features

• Localization• Clustering (3.1)• Client Libraries (PHP, Java, etc.)• Demo-able/Quickstart WAR file• Quality Documentation• Active community mailing lists

Page 16: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Technical Design

• Use Spring IoC Container– DI, Localization, events, JdbcTemplate,

LdapTemplate, etc.

• Completely interface driven• Encourage customization and extension• Java 1.4+/Servlet 2.4 compatible

Page 17: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Adding Acegi and CAS to YOUR Application

Page 18: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Steps

Download– Spring 2.0 RC4– Acegi Security 1.0.1– CAS Server 3.0.5– Java 1.5– Apache Tomcat 5.5.17

• Add files from Acegi’s “tutorial” sample• Edit Spring Petclinic XML and JSP files

Page 19: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Demo

DEMO

Page 20: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

How Acegi Works

Page 21: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Filters Are Central

Servlet Container

WebUser FilterToBeanProxy

IoC Container

FilterChainProxy

Filter 1 Filter 3 Filter 4 Filter 5Filter 2

Filter X Servlet

Page 22: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Main Filters

Authorizes web filter requests based on URL patterns

FilterSecurityInterceptor

5

Converts Acegi Security exceptions into HTTP

ExceptionTranslationFilter

4

Puts Authentication into SecurityContextHolder

Authentication Mechanism Filters3

Clears SecurityContextHolderwhen logout requested

LogoutFilter2

Stores SecurityContextHolderbetween HTTP requests

HttpSessionContextIntegrationFilter

1

Main PurposeFilter Name#

Page 23: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Security Context Population

AuthenticationMechanism

Filter 3

Authentication“Request”

ProviderManager

Authentication“Response”

creates

creates

calls

SecurityContextHolder

populates returns

Page 24: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

How CAS Works

Page 25: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

CAS Protocol

Page 26: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Spring Web Flow

Servlet Container

WebUser DispatcherServlet WebFlow

Controller

action0 action1 actionnactionn-1. . .

Page 27: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

actionn

Credentials

creates

CentralAuthenticationServicecalls

AuthenticationManager

Authentication creates

returns

TicketRegistry

Ticketcreates

callscalls

Page 28: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Rutgers Experiences using Acegi/CAS

Page 29: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

What We Were Doing

• Duplicating authentication code on each application

• Multiple authentication methods• Sign in to each application• De-centralized authentication

Page 30: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

What Did We Do

• Introduced a portal• Centralized authentication• Single Sign On• Proxy Authentication• Introduced Acegi into Java applications

Page 31: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Benefits

• Better user experience• Minimized access to passwords• Created “horizontal” authentication

component

Page 32: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Conclusion

Page 33: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Conclusion

• Acegi Security is fully-featured solution– Many authentication strategies– Decoupled web and method authorization– Completely customizable by end users– Active community, quality documentation, etc.

• CAS is a fully-featured solution– Many authentication strategies– Easily pluggable and extensible– Active community, quality documentation, etc.– Support for multiple platforms

Page 34: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Conclusion

• Acegi and CAS “just work”. Go ahead and try it.

Page 35: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Resources

• http://www.acegisecurity.org• http://www.ja-sig.org/products/cas/• http://www.springframework.org• http://www.ja-sig.org/wiki

Page 36: Welcome to Spring Forward 2006 · • File System • X.509 ... – Spring 2.0 RC4 – Acegi Security 1.0.1 – CAS Server 3.0.5 – Java 1.5 – Apache Tomcat 5.5.17 • Add files

www.springforward2006.comSeptember 26, 2006 Penn State Great Valley

Q&A