Apache Shiro - Executive Summary



Similar documents
Apache Ki (formerly JSecurity) DevNexus

Security for Java Web Applications Using Apache Shiro

Spring Security 3.

SSO Eurécia. and external Applications. Purpose

Xerox DocuShare Security Features. Security White Paper

Qualtrics Single Sign-On Specification

ApacheCon Infinite Session Clustering with Apache Shiro & Cassandra

Lecture 9: Application of Cryptography

Crawl Proxy Installation and Configuration Guide

JVA-122. Secure Java Web Development

TROUBLESHOOTING RSA ACCESS MANAGER SINGLE SIGN-ON FOR WEB-BASED APPLICATIONS

<Insert Picture Here> Hudson Security Architecture. Winston Prakash. Click to edit Master subtitle style

CORISECIO. Quick Installation Guide Open XML Gateway

Multi Factor Authentication API

Accellion Secure File Transfer Cryptographic Module Security Policy Document Version 1.0. Accellion, Inc.

WebService Security. A guide to set up highly secured client-server communications using WS-Security extensions to the SOAP protocol

Using weblock s Servlet Filters for Application-Level Security

Dashlane Security Whitepaper

Authenticate and authorize API with Apigility. by Enrico Zimuel Software Engineer Apigility and ZF2 Team

FileMaker Server 9. Custom Web Publishing with PHP

Web Application Security Assessment and Vulnerability Mitigation Tests

Use Enterprise SSO as the Credential Server for Protected Sites

FileMaker Server 13. Custom Web Publishing with PHP

BlackBerry Enterprise Service 10. Secure Work Space for ios and Android Version: Security Note

Using Foundstone CookieDigger to Analyze Web Session Management

Guidelines for Developing Cryptographic Service Providers (CSPs) for Acrobat on Windows

Recommended readings. Lecture 11 - Securing Web. Applications. Security. Declarative Security

Configuring and Monitoring SiteMinder Policy Servers

An Ontology-based e-learning System for Network Security

Ligero Content Delivery Server. Documentum Content Integration with

Enterprise Application Security Workshop Series

Spring Security 3. rpafktl Pen source. intruders with this easy to follow practical guide. Secure your web applications against malicious

Windows Security and Directory Services for UNIX using Centrify DirectControl

Configuring Nex-Gen Web Load Balancer

Adobe Systems Incorporated

Oracle EBS Interface Connector User Guide V1.4

WebNow Single Sign-On Solutions

MS Enterprise Library 5.0 (Logging Application Block)

Enabling SSL and Client Certificates on the SAP J2EE Engine

TIBCO Spotfire Platform IT Brief

How To Use Saml 2.0 Single Sign On With Qualysguard

MOTOROLA MESSAGING SERVER SERVER AND MOTOROLA MYMAIL DESKTOP PLUS MODULE OVERVIEW. Security Policy REV 1.3, 10/2002

(n)code Solutions CA A DIVISION OF GUJARAT NARMADA VALLEY FERTILIZERS COMPANY LIMITED P ROCEDURE F OR D OWNLOADING

Single Sign-on (SSO) technologies for the Domino Web Server

What is Web Security? Motivation

vrealize Air Compliance OVA Installation and Deployment Guide

What s New in Juniper s SSL VPN Version 6.0

Absorb Single Sign-On (SSO) V3.0

PUBLIC Secure Login for SAP Single Sign-On Implementation Guide

SECUR IN MIRTH CONNECT. Best Practices and Vulnerabilities of Mirth Connect. Author: Jeff Campbell Technical Consultant, Galen Healthcare Solutions

CRYPTOGRAPHY AS A SERVICE

NetBrain Security Guidance

Configure the Application Server User Account on the Domain Server

Complete Java Web Development

McAfee Cloud Identity Manager

Identity Management in Liferay Overview and Best Practices. Liferay Portal 6.0 EE

Criteria for web application security check. Version

How encryption works to provide confidentiality. How hashing works to provide integrity. How digital signatures work to provide authenticity and

CrashPlan Security SECURITY CONTEXT TECHNOLOGY

FileMaker Server 12. Custom Web Publishing with PHP

UPGRADING TO XI 3.1 SP6 AND SINGLE SIGN ON. Chad Watson Sr. Business Intelligence Developer

MESSAGING SECURITY USING GLASSFISH AND OPEN MESSAGE QUEUE

JMETER - MONITOR TEST PLAN

Introduction...3 Terms in this Document...3 Conditions for Secure Operation...3 Requirements...3 Key Generation Requirements...

Security Yokogawa Users Group Conference & Exhibition Copyright Yokogawa Electric Corporation Sept. 9-11, 2014 Houston, TX - 1 -

Apache Sling A REST-based Web Application Framework Carsten Ziegeler cziegeler@apache.org ApacheCon NA 2014

Data Collection and Analysis: Get End-to-End Security with Cisco Connected Analytics for Network Deployment

Sichere Software- Entwicklung für Java Entwickler

Complying with PCI Data Security

vcommander will use SSL and session-based authentication to secure REST web services.

Install guide for Websphere 7.0

How To Secure Your Data Center From Hackers

Creating a User Profile for Outlook 2013

CA Performance Center

Secure File Transfer Appliance Security Policy Document Version 1.9. Accellion, Inc.

Department Service Integration with e-pramaan

Top Ten Web Application Vulnerabilities in J2EE. Vincent Partington and Eelco Klaver Xebia

Using the Adobe Access Server for Protected Streaming

Copyright 2014 Jaspersoft Corporation. All rights reserved. Printed in the U.S.A. Jaspersoft, the Jaspersoft

SecureDoc Disk Encryption Cryptographic Engine

Online signature API. Terms used in this document. The API in brief. Version 0.20,

Configuring Integrated Windows Authentication for JBoss with SAS 9.3 Web Applications

How To Manage A Server On A Jboss Application Platform (Jboss)

esoc SSA DC-I Part 1 - Single Sign-On and Access Management ICD

Configuring BEA WebLogic Server for Web Authentication with SAS 9.2 Web Applications

Configuring and Monitoring Citrix Branch Repeater

Web Application Guidelines

SENSE Security overview 2014

Release Notes Date: September 2013

Security Policy. Security Policy.

Using etoken for SSL Web Authentication. SSL V3.0 Overview

Oracle WebLogic Server 11g: Administration Essentials

OpenLDAP Oracle Enterprise Gateway Integration Guide


Programming with cryptography

MAPI Connector Overview

Transcription:

Apache Shiro - Executive Summary Apache Shiro is a powerful, easy-to-use Java Security Framework with a goal to be more powerful and easier to use than the standard Java APIs. If you have any interest in Security or need to add security features to you Java program, then you should view this presentation

Apache Shiro A Powerful and easy-to-use Java Security Framework Christopher Lynch - By Christopher Lynch

History - Origin Originally developed as JSecurity in 2004 By Les Hazlewood and Jeremy Haile They could not find a suitable Java Security Framework that operated well at the application level and was frustrated with JAAS (Java Authentication and Authorization Service). Quoted from http://en.wikipedia.org/wiki/java_authentication_an d_authorization_service

History Name Changes JSecurity was submitted to the Apache Software Foundation in 2008 and renamed Ki (pronounced key) due to trademark concerns. However, additional trademark concerns caused it to be renamed again to Shiro which is the Japanese word for Castle. I found some archived emails that showed Les Hazlewood nominated the name Shiro, and there was eventually some votes between Shiro and Aseca (Application SECurity Api) and Shiro won.

History - Version Apache Shiro 1.0 was released in July 2010. Version 1.1 was released in November 2010. Version 1.2 was released in January 2012. The current version is 1.2.1 which was released in July 2012.

Primary Concepts A powerful, easy-to-use Java Security framework that performs: Authentication Authorization Cryptography Session Management Can be used to secure any application: From Command-Line Applications, Mobile Applications to the largest web and enterprise applications.

Primary Concepts There are 3 main concepts in the Shiro Architecture: Subject Security Manager Realms

Primary Concepts - Subject Subject Refers to the current user. Who is the current user? Or, is the current user allowed to perform the requested action. To acquire the Subject using Shiro: import org.apache.shiro.subject.subject; import org.apache.shiro.securityutils; Subject currentuser = SecurityUtils.getSubject();

Primary Concepts Security Manager Manages security operations for all users. The heart of Shiro s architecture. An Umbrella object that references many internally nested security components that form an object graph. Once the security manager and its internal object graph is configured, it is usually left alone and the application developer spends almost all of their time with the Subject API.

Primary Concepts - Realms Acts as a bridge or connector between Shiro and your application s security data. A security-specific Data Access Object which encapsulates connection details for data sources and makes the association data available to Shiro as needed. When configuring Shiro, you must specify at least one Realm to use for authentication and/or authorization.

Primary Concepts - Authentication Authentication is the process of verifying a user s identity. This is typically done in 3 steps 1. Collect the user s identifying information (called principals) and supporting proof of identity (called credentials). 2. Submit the principals and credentials to the system. 3. If the submitted credentials match what the system expects for that user identity, the user is considered authenticated; otherwise, the user is not authenticated.

Primary Concepts - Authentication Code Example: //1. Acquire submitted principals and credentials. AuthenticationToken token = new UsernamePasswordToken( user, pass); //2. Get the current subject. Subject currentuser = SecurityUtils.getSubject(); //3. Login: currentuser.login( token );

Primary Concepts - Authentication Handling Failed Login: try { currentuser.login( token ); } catch(incorrectcredentialsexception e) { } catch( LockedAccountException lae ) { } catch( AuthenticationException ae ) { }

Primary Concepts - Authorization Access Control Controlling what the user can access in the application, such as resources, web pages, etc. Code Example: if( subject.hasrole( administrator ) ) { // Show the create user button } else { // Grey-out the button }

Primary Concepts - Authorization Can rewrite previous example: if( subject.ispermitted( user:create )) { // Show the create user button } else { // Grey-out the button }

Primary Concepts Session Management Christopher Lynch - Shiro enables a Session programming paradigm for any application. Shiro s sessions are container-independent Shiro allows for pluggable Session data stores. Such as enterprise caches, relational databases, NoSQL systems, etc. You can configure session clustering once, and it will work the same way regardless of your deployment environment.

Primary Concepts Session Management Christopher Lynch - Code example: Can simply obtain the session from the subject: Session session = subject.getsession(); session.getattribute( key, somevalue ); Date start = session.getstarttimestamp(); Date timestamp = session.getlastaccesstime(); session.settimeout( millis );

Primary Concepts - Cryptography Shiro s goal in cryptography is to simplify and make usable the JDK s cryptography support. Cryptography is not specific to Subjects in general, so Shiro s API for cryptography is not Subject specific. Shiro focuses on cryptographic hashes (aka message digests) and cryptic ciphers.

Primary Concepts - Cryptography Cryptographic Hashing JDK method JDK uses the MessageDigest for cryptographic hashing It has an awkward static method factory-based API instead of an object-oriented one. Your are forced to catch checked exceptions that may never need to be caught. There is no support for hex-encode or Base64- encode message digest output.

Primary Concepts - Cryptography Cryptographic Hashing Shiro method Shiro has simplified the API so that it is much easier to use. Shiro has added support for hex-encode and Base64-encode message digest output.

Primary Concepts - Cryptography Cryptographic Hashing Code example without Shiro: try { MessageDigest md = MessageDigest.getInstance( MD5 ); md.digest( bytes ); byte[] hashed = md.digest(); } catch( NoSuchAlgorithmException e ) { //Handle Error. }

Primary Concepts - Cryptography Cryptographic Hashing Code example without Shiro: String hex = new Md5Hash(myFile).toHex(); SHA-512 hashing and Base64-encoding of passwords is just as easy: String encodedpassword = new Sha512Hash( password, salt, count ).tobase64();

Primary Concepts - Cryptography Cryptic Ciphers Ciphers are cryptographic algorithms that can reversibly transform data using a key. Shiro introduces CipherService API: a simple, stateless, thread-safe, that can encrypt or decrypt data in one method call. Shiro supports both byte-array encryption/decryption as well as stream-based encryption/decryption.

Primary Concepts - Cryptography Cryptic Ciphers Sample code: AesCipherService cipherservice = new AesCipherService(); cipherservice.setkeysize(256); //create a test key: byte[] testkey = cipherservice.generatenewkey(); //encrypt a file s bytes: byte[] encrypted = cipherservice.encrypt( filebyte, testkey);

Primary Concepts Web Support Shiro ships with a robust web support module. Only need to define a Shiro Servlet Filter in web.xml: <filter> <filter-name>shirofilter</filter-name> <filter-class> org.apache.shiro.web.servlet.inishirofilter </filter-class> <!--no init-param means load the INI config from classpath:shiro.ini --> </filter> <filter-mapping> <filter-name>shirofilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

Primary Concepts Web Support web.xml example: This filter can read shiro.ini to get a consistent configuration experience regardless of the deployment environment. Once configured, the Shiro Filter will filter every request and ensure the request-specific Subject is accessible during the request. You can perform security-specific logic to ensure only requests that meet certain criteria are allowed through.

Primary Concepts Web Support Shiro allows you to specify ad-hoc filter chains for any matching URL pattern. This gives you a great deal of flexibility in enforcing security rules.

Primary Concepts Web Support URL-Specific Filter Chains: Just need to configure in shiro.ini: [urls] /assets/** = anon /user/signup = anon /user/** = user /rpc/reset/** = perms[rpc:invoke], authc /** = authc The values on the left of the = represent a contextrelative web application path. The values on the right define a filter chain.

Primary Concepts Web Support URL-Specific Filter Chains A filter chain is an ordered, comma delimited list of Servlet filters to execute for the given path. Each filter is a normal Servlet Filter. anon, user, perms and authc are special securityrelated filters that Shiro provides out-of-the-box. You can use any combination of the security filters including specifying your own.

Primary Concepts Web Support JSP Tag Library This allows you to control the output of your JSP pages based on the current Subject s state. <%@ taglib prefix="shiro uri="http://shiro.apache.org/tags" %>... <p>hello <shiro:user> <!-- shiro:principal prints out the Subject s main principal - in this case, a username: --> <shiro:principal/>! </shiro:user> <shiro:guest> <!-- not logged in - considered a guest. Show the register link: -->! <a href= register.jsp >Register today!</a> </shiro:guest> </p>

Primary Concepts Web Support JSP Tag Library There are other tags that allow you to include output based on what roles exist or don t exist, what permissions are assigned or not, and whether they are authenticated, remembered (from Remember Me services), or an anonymous guest.

Primary Concepts Limitations Shiro does not currently deal with Virtual Machine level security. For example, cannot prevent certain classes from loading in a class loader based on an access control policy. Shiro does not currently natively support multistage authentication, where a user might login via one mechanism, only to be asked to login again via a different mechanism. A real possibility that this will be supported in the future.

Primary Concepts Limitations Currently, all Realm implementations support read operations for acquiring authentication and authorization data to perform logins and access control. Write operations, like creating user accounts, are not supported. This is because the data model to support these operations varies dramatically across applications, and it would be difficult to enforce a write API on all Shiro users.

Conclusion Shiro powerful and easy-to-use Java Security framework that provides APIs for Authentication Authorization Sessions Cryptography Web Support