Authenticating REST services in OpenEdge



Similar documents
Progress OpenEdge REST

Advanced OpenEdge REST/Mobile Security

Mobile Security Jump Start. Wayne Henshaw & Mike Jacobs Progress OpenEdge October 8, 2013

OpenLDAP Oracle Enterprise Gateway Integration Guide

Debugging Mobile Apps

Security Workshop 2013 Improving Security in a Hacker s World

IBM SPSS Collaboration and Deployment Services Version 6 Release 0. Single Sign-On Services Developer's Guide

Using LDAP Authentication in a PowerCenter Domain

Certified Secure Web Application Secure Development Checklist

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

Instant Chime for IBM Sametime Installation Guide for Apache Tomcat and Microsoft SQL

Crawl Proxy Installation and Configuration Guide

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

Microsoft Active Directory Oracle Enterprise Gateway Integration Guide

Pacific Application Server for OpenEdge: Getting Started. Progress OpenEdge 11.5 Workshop

OpenAM. 1 open source 1 community experience distilled. Single Sign-On (SSO) tool for securing your web. applications in a fast and easy way

Agenda. How to configure

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

UFTP AUTHENTICATION SERVICE

Table of Contents. Open-Xchange Authentication & Session Handling. 1.Introduction...3

From the Intranet to Mobile. By Divya Mehra and Stian Thorgersen

Configuration Worksheets for Oracle WebCenter Ensemble 10.3

Setup Guide Access Manager 3.2 SP3

LDAP User Service Guide 30 June 2006

<Insert Picture Here> Oracle Web Cache 11g Overview

vcloud Air Platform Programmer's Guide

Criteria for web application security check. Version

Configuring and Using the TMM with LDAP / Active Directory

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Secure Messaging Server Console... 2

Siteminder Integration Guide

Copyright: WhosOnLocation Limited

HireDesk API V1.0 Developer s Guide

Title page. Alcatel-Lucent 5620 SERVICE AWARE MANAGER 13.0 R7

INTEGRATE SALESFORCE.COM SINGLE SIGN-ON WITH THIRD-PARTY SINGLE SIGN-ON USING SENTRY A GUIDE TO SUCCESSFUL USE CASE

Xerox DocuShare Security Features. Security White Paper

There are more security levels in ARCHIBUS, as described bellow.

HTTP. Internet Engineering. Fall Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

Single-sign-on between MWS custom portlets and IS services

Authentication Methods

Fairsail REST API: Guide for Developers

Contents About the Contract Management Post Installation Administrator's Guide... 5 Viewing and Modifying Contract Management Settings...

WebNow Single Sign-On Solutions

OAuth 2.0 Developers Guide. Ping Identity, Inc th Street, Suite 100, Denver, CO

LDAP Authentication and Authorization

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

Shibboleth Identity Provider (IdP) Sebastian Rieger

SAML Security Option White Paper

SAML-Based SSO Solution

F-Secure Messaging Security Gateway. Deployment Guide

Getting Started with Clearlogin A Guide for Administrators V1.01

SSL CONFIGURATION GUIDE

Introduction to Directory Services

Use Enterprise SSO as the Credential Server for Protected Sites

Tenrox. Single Sign-On (SSO) Setup Guide. January, Tenrox. All rights reserved.

Tenable for CyberArk

CA Performance Center

Ricardo Perdigao, Solutions Architect Edsel Garcia, Principal Software Engineer Jean Munro, Senior Systems Engineer Dan Mitchell, Principal Systems

IBM WebSphere Portal Integrator for SAP

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

The HTTP Plug-in. Table of contents

Configuring EPM System for SAML2-based Federation Services SSO

SSL VPN Server Guide. Access Manager 3.2 SP2. June 2013

Axway API Gateway. Version 7.4.1

Lucid Key Server v2 Installation Documentation.

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

Cisco TelePresence Authenticating Cisco VCS Accounts Using LDAP

NSi Mobile Installation Guide. Version 6.2

TMS Phone Books Troubleshoot Guide

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

GENERAL OVERVIEW OF VARIOUS SSO SYSTEMS: ACTIVE DIRECTORY, GOOGLE & FACEBOOK

OIOSAML 2.0 Toolkits Test results May 2009

LDAP User Guide PowerSchool Premier 5.1 Student Information System

GlobalSign Enterprise Solutions Google Apps Authentication User Guide

Configuring Single Sign-on for WebVPN

Using SAML for Single Sign-On in the SOA Software Platform

Web Based Single Sign-On and Access Control

Programming Autodesk PLM 360 Using REST. Doug Redmond Software Engineer, Autodesk

SSL VPN Server Guide Access Manager 3.1 SP5 January 2013

ACCESSING THE PROGRESS OPENEDGE APPSERVER FROM PROGRESS ROLLBASE USING JSDO CODE

Policy Guide Access Manager 3.1 SP5 January 2013

Perceptive Experience Single Sign-On Solutions

Centralized Oracle Database Authentication and Authorization in a Directory

Office 365 deployment checklists

Certified Secure Web Application Security Test Checklist

From centralized to single sign on

Perceptive Integration Server

Integrating IBM Cognos 8 BI with 3rd Party Auhtentication Proxies

REST web services. Representational State Transfer Author: Nemanja Kojic

OpenHRE Security Architecture. (DRAFT v0.5)

Managing Identities and Admin Access

Configuring the Cisco ISA500 for Active Directory/LDAP and RADIUS Authentication

Authentication and Single Sign On

SAAS. Best practices for SAAS implementation using an Open Source Portal (JBoss)

Integrating VMware Horizon Workspace and VMware Horizon View TECHNICAL WHITE PAPER

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

About Me. Software Architect with ShapeBlue Specialise in. 3 rd party integrations and features in CloudStack

Cross-domain Identity Management System for Cloud Environment

Configuring ActiveVOS Identity Service Using LDAP

Transcription:

Authenticating REST services in OpenEdge Controlling business logic access via OE Realm & LDAP Peter Judge, Progress Software pjudge@progress.com

Abstract Slides-only précis of the REST Security Workshop Paul Koufalis & I presented at the EMEA PUG Challenge this year It covers securing REST services using OERealm authentication LDAP authentication Role-based authorization Cross Origin Resource Sharing (CORS) Assumes you're using PASOE, but applies to classic AppServer too 2

Who is this Peter Judge person? Peter Judge pjudge@progress.com Software Architect @ Progress since 2003 Integration-y stuff: HTTP-Out, Corticon OE Best Practices / OERA / AutoEdge / CCS 4GL since 1996 3

Agenda Introduction to PAS/OE & REST What is a REST security architecture? What's LDAP? URL-based authorization CORS Considerations for a production environment Logging for fun & profit 4

REST-based ABL services 5

What is REST? REpresentational State Transfer: an architecture for designing networked applications In English: Uses HTTP URLs and verbs to provide web services GET http://myweb.com/stuff/rest/customers/24 will return customer #24 GET http://myweb.com/stuff/rest/customers will return all customers PUT http://myweb.com/stuff/rest/customers/24 will update customer #24 Some features: Client-Server: pull- or request-based Stateless: each request must contain all information necessary to understand the request Cacheable Uniform interface: all resources accessed via generic interface 6

What is REST? Practically, JSON payloads to and fro over HTTP, using a particular style of URL JSON content types : application/json application/vnd.[vendor]+json GET /users/peterjudge-psc HTTP/1.1 Host: api.github.com Accept: application/vnd.github.v3+json User-Agent: OpenEdge-HttpClient/0.3.0 HTTP/1.1 200 OK Cache-Control: public, max-age=60, s-maxage=60 Content-Encoding: gzip Content-Type: application/json; charset=utf-8 Server: GitHub.com headers headers { "login": "PeterJudge-PSC", "id": 2736095, "url": "https://api.github.com/users/peterjudge-psc", "repos_url": "https://api.github.com/users/peterjudge-psc/repos", "type": "User", "updated_at": "2015-03-04T20:44:24Z } request response 7

OpenEdge REST Services Each deployed OE REST web application has A web application name One or more REST services A security configuration ( user authentication and [URL] authorization ) A connection to an AppServer [ABL service] Example OpenEdge REST web application : http://host:port/webappname/rest/ deployment site defined part OE defined part 8

RESTful Service and URL Design A REST service Has a service-name that appears in the URL A service-name contains one or more REST resources Each resource has a unique URL path within the service Each resource URL path can have optional input parameters and/or options Example http://host:port/webappname/rest/<service-name>/<resource-path> developer designed part 9

You Choose What Goes Where Routing HTTP method + URI => class + method Alt. =>persistent proc + internal proc Mapping HTTP message into ABL arguments URL parameters Headers Cookies Server Context

Securing Your OE REST Web Service Security provided in layers SSL/TLS to encrypt data-in-transit between client and web server and between web server and AppServer Web application (Tomcat) session management Spring Security for authentication Can also provide authorization OpenEdge AppServer for application level authorization 11

Authentication and Authorization Authentication Identifies a user, using factors Something the user knows (e.g. password) Something the user has (e.g. security token) Something of the user (e.g. biometric) Verify that a user is who they say they are We need to be able to trust this fact, as do others Authorization What services can the user access? What data can the user see and/or modify? Multi-tenancy Record-level, field-level 12

Spring Security OpenEdge supplements the Java container s security with the industry-recognized Spring security framework Spring Security is a customizable authentication and access control framework http://projects.spring.io/spring-security/ It is one of the industry standards for securing Spring-based applications 13

Web Application Authentication Models Anonymous : No user authentication or login session HTTP Basic or Digest Authentication Client sends base64 encoded user name/password to web application in each http request HTTP header: Authorization HTTP Form Authentication Client logs in and out the web application once per session Login: The client obtains user credentials and POSTs them to the web application Logout: The client uses a GET request to log out 14

Common Authentication Providers In-memory user accounts in configuration file Local file user accounts in clear-text file Container user account authenticated by Java container LDAP / AD user accounts in a Directory Service (11.2.1+) OERealm OpenEdge AppServer service (11.3+) 15

What is a REST security architecture? 16

Components of a security architecture Security tokens & Security Token Service Authentication flows Configuring Spring Security Flow of a CLIENT-PRINCIPAL through an application 17

What is a Security Token? A transportable block of data that can be used as proof of user identity by any systems or applications that have a trust relationship with the originator of the security token Exists for same reason passports do: so that a gatekeeper doesn t have to ask you for everything every time you want to pass Enables Single Sign On (SSO) Authenticate once and allow access many times across (ABL) processes Secure, time sensitive and data-integrity protected CLIENT-PRINCIPAL = ABL security token Sets current identity in any connected db or AVM session A security token service (STS) is the service component that builds, signs, and issues security tokens [1] [1] https://msdn.microsoft.com/en-us/library/ee748490.aspx 18

Authentication flows between client, STS and AppServer Client PAS/OE Security Token Service (Spring Security) LoginUser() LogoutUser() ValidateUser Domain Services (ABL) security-policy:set-client( ) CustomerSvc:ReadAllCustomers( ) Single Point AuthN ValidateUser() ValidatePassword() GetAttributes() 19

Authentication flows between client, STS and AppServer Client GET /customers PAS/OE Security Token Service (Spring Security) LoginUser() LogoutUser() ValidateUser Domain Services (ABL) security-policy:set-client( ) CustomerSvc:ReadAllCustomers( ) Single Point AuthN ValidateUser() ValidatePassword() GetAttributes() 20

Authentication flows between client, STS and AppServer Client GET /customers Authorization: mary/letmein PAS/OE Security Token Service (Spring Security) LoginUser() LogoutUser() ValidateUser Domain Services (ABL) security-policy:set-client( ) CustomerSvc:ReadAllCustomers( ) Single Point AuthN ValidateUser() ValidatePassword() GetAttributes() 21

Authentication flows between client, STS and AppServer Client GET /customers Authorization: mary/letmein PAS/OE Security Token Service LoginUser() LogoutUser() ValidateUser Domain Services security-policy:set-client( ) CustomerSvc:ReadAllCustomers( ) Single Point AuthN ValidateUser() ValidatePassword() GetAttributes() 22

Authentication flows between client, STS and AppServer Client GET /customers Authorization: mary/letmein PAS/OE Security Token Service LoginUser() LogoutUser() ValidateUser Domain Services (ABL) security-policy:set-client( ) CustomerSvc:ReadAllCustomers( ) Single Point AuthN ValidateUser() ValidatePassword() GetAttributes() 23

Authentication flows between client, STS and AppServer Client GET /customers Authorization: mary/letmein PAS/OE Security Token Service LoginUser() LogoutUser() ValidateUser Domain Services security-policy:set-client( ) CustomerSvc:ReadAllCustomers( ) Single Point AuthN ValidateUser() ValidatePassword() GetAttributes() 24

What Are Domains? A group of users with a common set of Roles and responsibilities Level of security Data access privileges Configured in db meta-schema Authentication systems Tenants _sec-authentication-domain _Domain-name _Domain-type _Domain-description _Domain-access-code _Domain-runtime-options _Tenant-name _Domain-enabled 25

Flow of CLIENT-PRINCIPAL through an application Domain Services security-policy:set-client( ) CustomerSvc:ReadAllCustomers( ) STS passes credentials into AVM using CURRENT-REQUEST-INFO CLIENT-PRINCIPAL available in activation event procedure Credentials can be asserted on session or per-database SECURITY-POLICY:SET-CLIENT(<client-principal>) SET-DB-CLIENT(<client-principal>, <database>) Token is validated against an existing domain Domain name & access code must match for successful authentication 26

Authentication using an OpenEdge Realm 27

OE Realm details Class-based implementation of the Progress.Security.Realm.IHybridRealm interface SPA does NOT create, seal or otherwise operate on CLIENT-PRINCIPALs Requires integer type user id ValidateUser(input <character>) returns <integer> Roles are Just Another Attribute Single Point of Authentication ValidateUser() ValidatePassword() GetAttributes() 28

OERealm config: ValidateUser() Example METHOD PUBLIC INTEGER ValidateUser( INPUT p0 AS CHARACTER ): DEFINE VARIABLE cname AS CHARACTER NO-UNDO. DEFINE VARIABLE cdomain AS CHARACTER NO-UNDO. cname = ENTRY(1, p0, '@'). IF NUM-ENTRIES(p0, '@') GE 2 THEN cdomain = ENTRY(2, p0, '@'). FIND ApplicationUser WHERE ApplicationUser.LoginName = cname AND ApplicationUser.LoginDomain = cdomain NO-LOCK NO-ERROR. IF AVAILABLE ApplicationUser THEN RETURN ApplicationUser.Id. RETURN?. END METHOD. 29

OERealm config: GetAttribute() Example METHOD PUBLIC CHARACTER GetAttribute( INPUT p0 AS INTEGER, INPUT p1 AS CHARACTER ): DEFINE VARIABLE cattribute AS CHARACTER NO-UNDO. CASE p1: WHEN "ATTR_ROLES" THEN DO: FIND ApplicationUser WHERE ApplicationUser.Id EQ p0 NO-LOCK NO-ERROR. FOR EACH GrantedRole WHERE GrantedRole.Grantee EQ LC(ApplicationUser.LoginName) + '@' + LC(ApplicationUser.LoginDomain) NO-LOCK: cattribute = cattribute + ',' + GrantedRole.RoleName. END. END. END CASE. RETURN cattribute. END METHOD. 30

Config: Using the client-principal in ABL AppServer startup procedure DEFINE INPUT PARAMETER pstartupinfo AS CHARACTER NO-UNDO. SECURITY-POLICY:LOAD-DOMAINS("sports"). 31

Config: Using the client-principal in ABL AppServer activate procedure DEFINE VARIABLE hcp AS HANDLE NO-UNDO. IF SESSION:CURRENT-REQUEST-INFO:ProcedureName BEGINS "Demo.Security.SportsRealm" THEN RETURN. ASSIGN hcp = SESSION:CURRENT-REQUEST-INFO:GetClientPrincipal(). /* this is the important bit: we do not want to set this on our security client */ SET-DB-CLIENT(hCP, 'sports'). CATCH oerror AS Progress.Lang.Error : DEF VAR i AS INT. DO i = 1 TO oerror:nummessages: LOG-MANAGER:WRITE-MESSAGE(oError:GetMessage(i), 'ACTV8ERR'). END. LOG-MANAGER:WRITE-MESSAGE(oError:CallStack, 'ACTV8ERR'). /* blow up */ RETURN ERROR oerror:getmessage(1). END CATCH. 32

Config: Authentication Providers : web.xml <context-param> <param-name>contextconfiglocation</param-name> <param-value> <!-- USER EDIT: Select which application security model to employ /WEB-INF/oeablSecurity-basic-local.xml /WEB-INF/oeablSecurity-anonymous.xml /WEB-INF/oeablSecurity-form-local.xml /WEB-INF/oeablSecurity-container.xml /WEB-INF/oeablSecurity-basic-ldap.xml /WEB-INF/oeablSecurity-form-ldap.xml /WEB-INF/oeablSecurity-basic-oerealm.xml /WEB-INF/oeablSecurity-form-oerealm.xml /WEB-INF/oeablSecurity-form-saml.xml /WEB-INF/oeablSecurity-basic-saml.xml /WEB-INF/oeablSecurity-anonymous.xml --> /WEB-INF/oeablSecurity-basic-oerealm.xml </param-value> </context-param> 33

Config: Authentication Providers : web.xml <context-param> <param-name>contextconfiglocation</param-name> <param-value> <!-- USER EDIT: Select which application security model to employ /WEB-INF/oeablSecurity-basic-local.xml /WEB-INF/oeablSecurity-anonymous.xml /WEB-INF/oeablSecurity-form-local.xml /WEB-INF/oeablSecurity-container.xml /WEB-INF/oeablSecurity-basic-ldap.xml /WEB-INF/oeablSecurity-form-ldap.xml --> /WEB-INF/oeablSecurity-basic-oerealm.xml /WEB-INF/oeablSecurity-form-oerealm.xml /WEB-INF/oeablSecurity-form-saml.xml /WEB-INF/oeablSecurity-basic-saml.xml /WEB-INF/oeablSecurity-anonymous.xml /WEB-INF/oeablSecurity-basic-oerealm.xml Authentication provider 34 </param-value> </context-param> Authentication model

Spring config: realm location <b:bean id="oerealmuserdetails" class="com.progress.appserv.services.security.oerealmuserdetailsimpl" > <b:property name="realmurl" value="internal://localhost/nxgas" /> <b:property name="realmclass" value="demo.security.sportsrealm" /> <b:property name="grantedauthorities" value="role_pscuser" /> <b:property name="roleprefix" value="role_" /> <b:property name="roleattrname" value="attr_roles" /> <b:property name="enabledattrname" value="attr_enabled" /> <b:property name="lockedattrname" value="attr_locked" /> <b:property name="expiredattrname" value="attr_expired" /> 35

Spring config: passing a client-principal to the AppServer <b:bean id="oerealmauthprovider" class= "com.progress.appserv.services.security.oerealmauthprovider" > <b:property name="userdetailsservice"> <b:ref bean="oerealmuserdetails"/> </b:property> <b:property name="createcpauthn" value="true" /> <b:property name="multitenant" value="false" /> <b:property name="userdomain" value="sports" /> <b:property name="key" value="abc123" /> 36

LDAP Authentication 37

LDAP Essentials Single manageable location for enterprise configurations LDAP (Lightweight Directory Access Protocol) is a wire protocol and client API LDAP Directory Services widely used for single point of administration Most commonly recognized as a Single Point of Authentication (SPA) A directory service is hierarchical store of schema defined objects and object attributes Examples: OpenLDAP, Windows Active Directory, Apache DS No two production sites will have the same hierarchy ( of users & groups ) 38

Key Directory Service Terms and Concepts Distinguished Name ( DN ) The path to a specific data object Root DN: the name of the object hierarchy's root data object example: dc=acme,dc=com Fully qualified DN: full path to the object from the root DN to the object example: dn=ldapserver1,ou=it,dc=acme,dc=com Relative DN: example: dn=ldapserver (child object of: ou=it,dc=acme,dc=com) Search root: the fully qualified DN of the data object at which to begin a decending search for one or more data objects 39

Key Directory Service Terms and Concepts (cont'd) Directory Services require logging in to search information Security policies prevent read/write of another user s password attribute Passwords are stored as salted one-way hashes To test a user account s password for login 1. You have to login with a fully qualified DN that has search privileges 2. Search to find the user s account and retrieve its fully qualified DN 3. Logout 4. Login using the user account s fully qualified DN and password 5. Retrieve user attributes - primarily the Groups (i.e. Role) they are a member of 6. Logout 40

Required Information From Directory Service Admin 1. Network address and ports of the Directory Service "foo.com" 389 2. ROOT DN of the directory service "dc=foo, dc=com" 3. DN & password of an account with query privilege "uid=admin, ou=ds admins, ou=it, dc=foo, dc=com" 4. LDAP DN of the object where the user object search will start 5. LDAP user account object s attribute name that holds the user s login ID 6. LDAP DN of the object where the search for LDAP user groups (roles) will start 7. LDAP group object s attribute name whose value will be the role name inserted into the user s login token "ou=users, ou=employees, dc=foo, dc=com" "uid" 8. LDAP Group attribute holding the Role/Group name "cn" "ou=groups,dc=foo,dc=com" "uniquemember" or "roleoccupant" 41

Example directory 42

Configuring Spring Security LDAP: Directory access <ldap-server id="primayldap" url="ldap://localhost:10389 /dc=xxx,dc=yyy" 1 2 /> manager-dn= "uid=admin,ou=system" manager-password="secret" 43

Configuring Spring Security LDAP: Directory access <ldap-server id="primayldap" url="ldap://localhost:10389 /dc=xxx,dc=yyy" 1 2 /> manager-dn= "uid=admin,ou=system" manager-password="secret" 3 44

Configuring Spring Security LDAP: Authentication Manager <authentication-manager id="oeablapplicationauth"> <ldap-authentication-provider server-ref="primayldap" role-prefix="role_" group-search-base= "ou=groups,ou=sports,ou=tenants, dc=pugchallenge,dc=org" group-role-attribute="cn" group-search-filter="(roleoccupant={0})" user-search-base= "ou=users,ou=sports,ou=tenants, 4 dc=pugchallenge,dc=org" user-search-filter="(uid={0})" /> </authentication-manager> 45

Configuring Spring Security LDAP: Authentication Manager <authentication-manager id="oeablapplicationauth"> <ldap-authentication-provider server-ref="primayldap" role-prefix="role_" group-search-base= "ou=groups,ou=sports,ou=tenants, dc=pugchallenge,dc=org" group-role-attribute="cn" group-search-filter="(roleoccupant={0})" user-search-base= "ou=users,ou=sports,ou=tenants, 4 dc=pugchallenge,dc=org" user-search-filter="(uid={0})" /> </authentication-manager> 5 46

Configuring Spring Security LDAP: Authentication Manager <authentication-manager id="oeablapplicationauth"> <ldap-authentication-provider server-ref="primayldap" role-prefix="role_" group-search-base= "ou=groups,ou=sports,ou=tenants, dc=pugchallenge,dc=org" group-role-attribute="cn" group-search-filter="(roleoccupant={0})" user-search-base= "ou=users,ou=sports,ou=tenants, 4 dc=pugchallenge,dc=org" user-search-filter="(uid={0})" /> </authentication-manager> uid=peter, ou=users,ou=sports,ou=tenants,dc=pugchallenge,dc=org 5 47

Configuring Spring Security LDAP: Authentication Manager <authentication-manager id="oeablapplicationauth"> <ldap-authentication-provider server-ref="primayldap" role-prefix="role_" 6 group-search-base= "ou=groups,ou=sports,ou=tenants, dc=pugchallenge,dc=org" group-role-attribute="cn" group-search-filter="(roleoccupant={0})" user-search-base= "ou=users,ou=sports,ou=tenants, dc=pugchallenge,dc=org" user-search-filter="(uid={0})" /> </authentication-manager> 48

Configuring Spring Security LDAP: Authentication Manager <authentication-manager id="oeablapplicationauth"> <ldap-authentication-provider server-ref="primayldap" role-prefix="role_" group-search-base= "ou=groups,ou=sports,ou=tenants, dc=pugchallenge,dc=org" group-role-attribute="cn" group-search-filter="(roleoccupant={0})" user-search-base= "ou=users,ou=sports,ou=tenants, dc=pugchallenge,dc=org" user-search-filter="(uid={0})" /> </authentication-manager> 7 6 49

Configuring Spring Security LDAP: Authentication Manager <authentication-manager id="oeablapplicationauth"> <ldap-authentication-provider server-ref="primayldap" role-prefix="role_" group-search-base= "ou=groups,ou=sports,ou=tenants, dc=pugchallenge,dc=org" group-role-attribute="cn" group-search-filter="(roleoccupant={0})" user-search-base= "ou=users,ou=sports,ou=tenants, dc=pugchallenge,dc=org" user-search-filter="(uid={0})" /> </authentication-manager> 7 6 8 50

Configuring Spring Security LDAP: Authentication Manager <authentication-manager id="oeablapplicationauth"> <ldap-authentication-provider server-ref="primayldap" role-prefix="role_" 6 group-search-base= cn=customer.read "ou=groups,ou=sports,ou=tenants, cn=customer.update dc=pugchallenge,dc=org" group-role-attribute="cn" cn=pscuser group-search-filter="(roleoccupant={0})" user-search-base= "ou=users,ou=sports,ou=tenants, dc=pugchallenge,dc=org" user-search-filter="(uid={0})" /> </authentication-manager> 7 8 51

Role-based Authorization 52

Intercept URLs A means to provide authorization based on a URL + method (verb) We use role-based authorization An intercept-url element (filter) contains three attributes Pattern: A URI pattern relative to the web application. The pattern can be as general or specific as required. Method: The HTTP method to which this element applies (optional) Access: The access (restriction) to apply when the pattern and method match the requested resource. Intercepts are processed in the order in which they appear in the configuration 53

Example intercept URL Specified in the oeablsecurity-*.xml security configuration file Add an intercept-url element under <http pattern="/rest/**" element pattern URL pattern to which this role authorization applies ** in path indicates it applies recursively pattern path is relative to the restsec webapp Look for other examples in XML file method - HTTP method; delete is what we want to restrict access - Authorize using hasanyrole('role_customer_delete') http://docs.spring.io/spring-security/site/docs/3.0.x/reference/el-access.html <intercept-url pattern="/rest/restws/customers/**" method="delete" access="hasanyrole('role_customer.delete')" /> 54

Example ABL authorization: get-salary.p define input param piempnum as integer. define output param pdsalary as decimal. define variable hcp as handle no-undo. hcp = get-db-client('sports'). if not can-do(hcp:roles, 'Employee.Read.Salary') then do: log-manager:write-message( 'Employee.Read.Salary attempt:' + hcp:qualified-user-id, 'AUTHZERR'). return error 'Access denied'. end. /* business logic to read salary info */ 55

Cross-Origin Resource Sharing (CORS) 56

Cross Origin Resource Sharing (CORS) A simplified example may be easiest to understand 1. Paul visits http://www.paul.com/customers.html 2. This page lists all customers by GETting /rest/restws/customers (using XMLHttpRequest) 3. If it GETs http://www.paul.com/restsec/rest/restws/customers this is a SAME ORIGIN request 4. If it GETs /rest/restws/customers from anywhere else this is a CROSS ORIGIN request Browsers generally dislike this for security reasons CORS is a mechanism that allows a web page loaded from one domain to make HTTP requests to access resources located in another domain PAS provides CORS functionality using the Open Source CORS Filter 57

CORS vs. NON-CORS CORS-enabled web servers classify all requests as 1. CORS request containing an Origin header 2. CORS preflight request containing Access-Control-Request-Method header in an OPTION request 3. A generic (non-cors) request that does not contain any CORS headers How the web server reacts to each of these requests is configured in the OECorsFilter in the oeablsecurity-*.xml file 58

Example : OpenEdge CORS Filter <!-- The security filter that implements the CORS standard for controling cross site resource access by http clients. --> <b:bean id="oecorsfilter" class="com.progress.appserv.services.security.oecorsfilter" > <b:property name="allowall" value="true" /> <b:property name="allowdomains" value="http://52.91.193.122:8810" /> <b:property name="allowsubdomains" value="false" /> <b:property name="allowmethods" value="" /> <b:property name="messageheaders" value="" /> <b:property name="responseheaders" value="" /> <b:property name="supportcredentials" value="true" /> <b:property name="maxage" value="-1" /> </b:bean> 59

Deploying in Production 60

Considerations for a production PASOE environment Authentication defaults to ANONYMOUS in PROD and DEV modes Our psychics were unable to determine your security mode when OE goes to FCS PLEASE DON'T LEAVE IT LIKE THIS Limited user and file permissions on UNIX installs Deployment tooling in PDSOE for DEV, not PROD May need changes to security XML files No r-code in PROD server Use traditional deployment means R-code in WAR via PDSOE in 11.6 Need to explicitly deploy oe-/manager to PROD 61

When Things Go Horribly Wrong 62

Logging is your friend Use SEC.AUTH log type with a high value to debug AVM-related issues Set in openedge.properties The REST service logging configuration found in <web-app-name>/web-inf/logging.xml <project>/pasoecontent/web-inf/logging.xml DEBUG and TRACE level produce lots of logging monitor log file sizes <!-- OEABL Security --> <logger name="com.progress.appserv.services.security" level="info"/> <!-- Spring Security --> <logger name="org.springframework" level="info"/> <logger name="org.springframework.security.web.access" level="info"/> <logger name="org.springframework.security.saml" level="info"/> <!-- SAML --> <logger name="org.opensaml" level="info"/> <logger name=" PROTOCOL_MESSAGE " level="info"/> 63

Debugging - http://localhost:8810/restsec/server/rest/services 64

Q&A pjudge@progress.com 65