implementing and securing openedge rest service interfaces
TRANSCRIPT
Implementing and Securing
OpenEdge REST Service
Interfaces
Solution Engineers @ Progress
29-10-2019
Conor Patten & Ruben Dröge
2© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Workshop Agenda
▪ REST Overview
▪ REST Techniques in OpenEdge
▪ Data Object Services
• Business Entity for a database table
• Business Entity from a prodataset schema
• Calling custom logic from Data Object Services
▪ Web Handler Services
• Creating a new Web Handler
• Creating a “custom” Web Handler
▪ Securing REST Services
▪ Data Object Handlers
3© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
REST Overview?
4© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Hypertext Transfer Protocol (HTTP) is a method for encoding and transportinginformation between a client (such as a web browser) and a web server. HTTP is the primary protocol for transmission of information across the Internet.
HTTP follows a request-response paradigm in which the client makes a request and the server issues a response that includes not only the requested content, but also relevant status information about the request.
Using HTTP and HTML, clients can request different kinds of content (such as text, images, video, and application data) from web and application servers that host the content.
HTTP resources such as web servers are identified across the Internet using uniqueidentifiers known as Uniform Resource Locators (URLs).
What is HTTP?
https://www.nginx.com/resources/glossary/http/
5© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Understood as HTTP with strong* constraints
▪ Named resources: resources are named using a URL
▪ Uniform interface: all resources accessed via generic interface (GET/PUT/POST/DELETE)
▪ Interconnected resource representations: the representations of the resources are inter-connected using URLs
▪ Stateless: each request must contain all the information necessary to understand the request; cannot take advantage of any stored context on the server
https://martinfowler.com/articles/richardsonMaturityModel.html
What is REST?
REST = REpresentational State Transfer
REST is an architectural style for network based software that requires stateless, cacheable, client-server communication via a uniform interface between components.
6© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
OERA
Presentation (UI) Enterprise Services (API)
Domain Services (*aaS)
Business Components
Data Access
Data Sources
Workflow Tasks Entities
Service InterfacesC
om
mo
n
Infra
stru
ctu
re
7© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
REST Use Cases
▪ Modern web interfaces
▪ Mobile apps
▪ Next big thing… Chat bots, Digital Voice Assistants
▪ Application integration: Public and Partner APIs
• Custom REST
• Standardized REST (OData)
▪ Application modularization
• Private Microservice interfaces (can be REST)
▪ BI, Reporting, Analytics
• Particularly standardized REST (OData)
8© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Why care about Service Interfaces?
There are different flavors of REST. Different use cases may require
different styles of REST APIs and Service Interface approaches…
▪ Kinvey Studio and Nativescript require a Data Service Catalog
▪ B2B REST APIs may require custom headers, query string support
▪ Some REST clients want ‘standards compliance’ (SFDC, Dynamics, BI…)
▪ ABL applications have various approaches for providing one
• By server architecture
• By target use case
• By development approach (product, services)
9© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Service Interfaces
▪ Service interfaces provide the translation layer between a request and the underlying business services
• Route requests
• Compose responses
• Error handling
▪ Provide authentication and authorization
▪ Translate input / output formats to and from domain model
• JSON/XML/text into ProDataSet/Temp-Table/objects
• Data validation
▪ Service interfaces are NOT business domain services or logic (like tax calculations, master data maintenance, order entry, etc.)
• It doesn't matter if you use OE Business Entities, PMFO Business Services or any other form of business logic
▪ Can be multiple Service Interfaces to the same backend business services
10© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
REST Options in OpenEdge 12.0
▪ Data Object Catalog
▪ Custom/DIY WebHandler
▪ Data Object Handler WebHandler
▪ OData view of OpenEdge DB (using Hybrid Data Pipeline)
▪ OData view of OpenEdge REST API (using HDP + ‘Autonomous
Rest Connector’)
11© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Workshop Environment
12© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Accessing Your Arcade ImageHost IP Address:_______________________________________
User Name: \administratorPassword: NEXT2018!
13© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Desktop Shortcuts
14© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Exercise 1 – Business Entity from a Table
15© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Service Interface Approaches
Data Object (WebHandler)
WebHandler
a
b
11.2.0 11.3.0 11.4.0 11.5.0 11.6.0 11.6.3
DataObjectHandlerc
• As of 11.6.3
• Annotate certain methods (w/
particular signatures)
• Quite prescriptive
• More flexibility in mapping
• Uses WEB transport
• Requires PAS for OpenEdge
• Creates Data Service Catalog as
public API
16© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Service interfaces
PASOE Architecture (11.6+)
Tom
cat
Web S
erv
er
Business logic (ABL)
SpeakerBE.cls
TalksBE.cls
REST ADAPTER
Transport /rest
Tech Java
Config .paar file
Artifacts .paar file
• Transform
data
• Validation
• Request &
response
• Route
requests
• Error handling
PASOE Server Instance
WEB HANDLER
Transport /web
Tech ABL
Config openedge.properties
Artifacts ABL classes
Service Interface (ABL)
EmployeeWebHandler.cls
17© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create New ProjectNEXT_dataObjSvc
18© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create New OpenEdgeProject
19© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Project Settings
20© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Service Deployment
21© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Service Naming
22© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
PropathSettings
23© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
PropathSettings
24© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
PropathSettings
25© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Database Settings
26© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
New Project Created
27© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create New Business Entity From a Database Table
28© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
New Business Entity
29© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create Business Entity Class
30© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Business Entity From a Table
31© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
SpeakerBE.cls
32© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
speakerbe.i
33© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Deploy to PASOE
34© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Deploy as a Service
35© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Deploy as a Service
36© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Deploy as a Service
37© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Deploy as a Service
38© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test the new Service
39© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test in Chrome
40© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Read Speakers in Insomnia
41© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create Speaker in Insomnia
42© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create New Business Entity From a Prodataset Schema
43© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Use include file instead of database table
44© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create Business Entity
45© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create Business Entity
46© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Select Schema from file
47© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Select dsTalkprodataset
48© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Select dsTalkprodataset
49© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Define Data Sources
50© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Check Syntax and Compile
51© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Deploy to Service
52© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test New Business Entity From a Prodataset Schema
53© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test in Chrome
54© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test in Insomnia
55© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create Talk
56© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Read Talks
57© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Calling Custom Logic
58© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Custom1.txt
59© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Locate Code
60© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Paste Code
61© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
new_talk.p
62© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
create_talk
63© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test(remove id)
64© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test invalid speaker
65© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test valid speaker
66© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
custom2.txt
67© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
ReadTalksBE
68© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Updated code
69© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
read_talks.p
70© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Testing Custom Logic
71© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test
72© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Web Handler
73© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
WebhandlerProject
74© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
WebhandlerProject
75© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
WebhandlerProject
76© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
WebhandlerProject
77© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
WebhandlerProject
78© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
WebhandlerProject
79© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test Web Handler
80© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test WebhandlerProject
81© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
HandleGet
82© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Delete Service
83© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create Service
84© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create Service
85© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Declare Class
86© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Resource URIs
87© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
TalksHandler
88© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
/talks/{talk-id}
89© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
read_talks.p
90© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test
91© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
/talks
92© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
custom3.txt
93© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Updated code
94© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test
95© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Create new talks
96© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
custom4.txt
97© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
TalksHandler
98© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test
99© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Header Tab
100© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
/web/talks
101© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Securing Your REST Services
102© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
users.properties
103© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
oeablSecurity.properties
104© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
oeablSecurity.csv
105© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Restart PASOE
106© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test SpeakerBE
http://localhost:8810/NEXT_dos/web/pdo/dos/SpeakerBE
107© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test SpeakerBE
http://localhost:8810/NEXT_dos/web/pdo/dos/SpeakerBE
108© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test TalksBE
http://localhost:8810/NEXT_dos/web/pdo/dos/TalksBE
109© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test TalksBE
http://localhost:8810/NEXT_dos/web/pdo/dos/TalksBE
110© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Test TalksBEwith James/Bond
http://localhost:8810/NEXT_dos/web/pdo/dos/TalksBE
111© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
oeablSecurity.properties.README
112© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
Data Object Handler
114© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
conf.map
115© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
URIs
116© 2019 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.
openedge.properties