lkrzyzanek / cas-jaas-ee6-integration-example

Example how to secure Java EE 6 application by Jasig CAS server via JAAS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CAS JAAS Integration Java EE 6 Example

This example shows how Java EE 6 app (JBoss AS 7 resp. EAP 6.2) can be integrated with CAS Single Sign On server.

In Addition to the CAS integration it shows how to write simple JAAS Login Module.

Example demonstrates securing:

  • JAX-RS REST via @PermitAll resp. @RolesAllowed annotations
  • Servlet via @ServletSecurity

After deployment you get:

  • / - main page with information about currently logged in user
  • Filter which examine HTTP Basic authentication. If present then triggers JAAS login.
  • /login/cas - single point for login to CAS server
  • /secured-servlet - secured servlet via @ServletSecurity annotation
  • /rest/test/public - public REST api
  • /rest/test/secure - secured REST api

Test Snippets

Test secured content without authentication

	curl http://localhost:8080/rest/test/secure
	output:
	401

Test secured content with authentication

	curl -u username:password http://localhost:8080/rest/test/secure
	output:
	OK, principal from security context: username

Test public content

	curl http://localhost:8080/rest/test/public
	output:
	OK PUBLIC

Configuration

Add Security Domain CasSecurityDomain to AS. See JBoss AS 7 / EAP 6.2 example in .openshift/config/standalone.xml

Resources

About

Example how to secure Java EE 6 application by Jasig CAS server via JAAS


Languages

Language:Java 90.7%Language:Perl 9.3%