SlideShare a Scribd company logo
Security enforcement of
Microservices with API
Management
Charles Moulliard (@cmoulliard)
17 June 2016
 
Who
Committer, Coder, Architect
Work on Apache Camel, Karaf, Fabric8, Hawtio, Apiman, Drools
Mountain Biker, Belgian Beer Fan
Blog:
Twitter:
Email:
http://cmoulliard.github.io
@cmoulliard
cmoulliard@redhat.com
Agenda
RESTfull Use case
How to Secure the Endpoint
Policy
Web Container
Api Management
Demo
Use case description
 
Use case
REST Service
@GET
@Path("/customers/{id}/")
@Produces("application/xml")
@ApiOperation(value="FindCustomerbyID",
notes="Morenotesaboutthismethod",
response=Customer.class)
@ApiResponses(value={
@ApiResponse(code=500,message="InvalidIDsupplied"),
@ApiResponse(code=204,message="Customernotfound")
})
publicCustomergetCustomer(@ApiParam(value="IDofCustomertofetch",
required=true)@PathParam("id")Stringid){
LOG.info("InvokinggetCustomer,Customeridis:{}",id);
longidNumber=Long.parseLong(id);
Customerc=customers.get(idNumber);
returnc;
}
Api documented : Swagger
How to Secure ?
 
Level !
Endpoint Framework/Policy/Interceptor
 
HTTP Web Container Handler & Constraints
 
Externally Api Manager
Endpoint Level
 
Endpoint level
Intercept
Framework based : Apache Shiro, Spring Security
Interceptor/Policy : Apache Camel, Apache CXF
JAXRS : @Roles
Camel Design
importorg.apache.camel.builder.RouterBuilder;
publicclassFilterRouteextendsRouteBuilder{
publicvoidconfigure()throwsException{
from("netty4-http://http://localhost:7777/camel/client)
.setHeader("id").simple("$header.CamelHttpQuery")
.beanRef("customerServer","getCustomer";
}
}
Interceptor
To trace, log, secure
Camel Endpoint
Goal Extract from the HTTP request the info needed to authenticate a
user
How Use a Camel Policy to wrap the Route / Pipeline with a new
processor


 
Camel Example
publicclassShiroSecurityPolicyimplementsAuthorizationPolicy{
publicProcessorwrap(RouteContextrouteContext,finalProcessorprocessor){
returnnewShiroSecurityProcessor(processor,this);
}
...
@Override
publicbooleanprocess(Exchangeexchange,AsyncCallbackcallback){
try{
applySecurityPolicy(exchange);
CXF Endpoint
How Using the ContainerRequestFilter JAXRS Interface
Rely on CXF Intercept

 
CXF Example
@Provider
@PreMatching
publicclassSecurityRequestFilterimplementsContainerRequestFilter{
@Override
publicvoidfilter(finalContainerRequestContextrequestContext)
throwsIOException{
...
Web HTTP Container
 
Web container level
HTTP Handler
How Apply Constraints on Web Resources path(s)
GET/rest/accountservice/accountforUser
POST/webservices/customerservices/customerforAdmin
Designed using JAAS JDBC, LDAP, Properties
Could use Roles

Jetty Example
Goal restrict or allow access to resources
How URL requested matched with one the rule(s)


Example
Constraintconstraint=newConstraint();
constraint.setRoles(newString[]{"user","admin"});
ConstraintMappingmapping=newConstraintMapping();
mapping.setPathSpec("/say/hello/*");
mapping.setMethod("GET");
mapping.setConstraint(constraint);
Login Auth Example
//DescribetheAuthenticationConstrainttobeapplied(BASIC,DIGEST,NEGOTIATE,...)
Constraintconstraint=newConstraint(Constraint.__BASIC_AUTH,"user");
constraint.setAuthenticate(true);
//MaptheAuthConstraintwithaPath
ConstraintMappingcm=newConstraintMapping();
cm.setPathSpec("/*");
cm.setConstraint(constraint);
HashLoginServiceloginService=newHashLoginService("MyRealm",
"myrealm.props");
ConstraintSecurityHandlersh=newConstraintSecurityHandler();
sh.setAuthenticator(newBasicAuthenticator());
sh.setConstraintMappings(cm);
sh.setLoginService(loginService);
JAXRS @Roles
Goal Allow/Deny Access to resources
How using annotation @RolesAllowed


Example
@Path("projects")
@Produces("application/json")
publicclassProjectsResource{
@POST
@RolesAllowed("manager")
publicProjectcreateProject(finalProjectproject){...}
@GET
@Path("{id}")
publicProjectgetProject(@PathParam("id")finalLongid){...}
Web Secured & Policy Level
Pros / Cons
 
Conclusions
Pros
No product lock
Great flexibility
Spec managed
Cons
Intrusive
Low Management Capability
Lack of Governance
External Player
 
Api Manager
Api Man
Goal Externalize/Delegate security endpoint to Api
 
How Api acts as a Proxy/Gateway matching :
Incoming request against 1 Many policies
Delivering requests to target endpoint if validation succeeds


Manager
Api
Security enforcement of Microservices with API Management
Api
Api Man - Basic Auth
How : Associate a Policy using the Basic Auth Plugin to an endpoint
"contracts":[
{
"apiOrgId":"Policy_BasicAuthStatic",
"apiId":"echo",
"apiVersion":"1.0.0",
"policies":[
{
"policyImpl":"class:io.apiman.gateway.engine.policies.BasicAuthenticationPol
"policyJsonConfig":"{"realm":"Test","forwardIdentityHttpHeader":
}
]
}
]
Api Man - OpenId connect
Goal Authenticate a user using an Identity provider to get a token used
for SSO purposes
Authentication between Client and Identity Provider: public, secret or PKI
JSon Web Token :
Compact token format,
Encode claims to be transmitted,
Base64url encoded and digitally signed and/or encrypted

OpenId connect - Example
{
"jti":"af68fac6-fd50-4b73-bd37-5c555a8e561e",
"exp":1442847825,
"nbf":0,
"iat":1442847525,
"iss":"http://localhost:8080/auth/realms/fuse",
"aud":"fuse",
"sub":"3591e417-7c60-4464-8714-96190c7fad92",
"azp":"fuse",
"session_state":"f58d5dfc-6e4c-4ad2-bd2f-70713f6b942d",
"client_session":"f06b673f-ecbe-47f2-ba76-b6a5901d5afe",
"allowed-origins":[],
"realm_access":{
"roles":[
"write"
]
},
"name":"writer",
"preferred_username":"writer",
"given_name":"writer"
}
Role Mapping
Goal Restrict/allow access to an application based on an Authorization
Rule
How Define a collection of Authorization rules as such & Combined with
Auth Plugin (Keycloak, Basic, …)


 
Path Verb Role required
.* PUT Writer
.* GET Reader
Discovery - Cloud Platform
Pros / Cons
 
Conclusions
Pros
Centralized governance policy configuration
Loose coupling
Tracking of APIs and consumers of those APIs
Gathering statistics/metrics
Service Discovery
Simplify security audit
Cons
Performance
New Architecture Brick
Features = plugins available 
Demo
 
Questions
Twitter : @cmoulliard
Apiman : , Fabric8 :http://apiman.io http://fabric8.io

More Related Content

PDF
Develop a Mobile Application coonected to a REST backend
PDF
Apiman - Open Source API Management @ JBCNConf 2016
PDF
MicroService and MicroContainer with Apache Camel
PDF
Design a Mobil Hybrid Application connected to a REST Backend
PPTX
API Management in Azure
PPTX
API as-a-Product with Azure API Management (APIM)
PPTX
Build 2017 - P4034 - Agile app development with Azure API Management
PPTX
Azure API Management - why should I care?
Develop a Mobile Application coonected to a REST backend
Apiman - Open Source API Management @ JBCNConf 2016
MicroService and MicroContainer with Apache Camel
Design a Mobil Hybrid Application connected to a REST Backend
API Management in Azure
API as-a-Product with Azure API Management (APIM)
Build 2017 - P4034 - Agile app development with Azure API Management
Azure API Management - why should I care?

What's hot (20)

PPTX
2013 02-apache conna-api-manager-asanka
PPTX
Azure API Management Update
PPTX
Best Practices for API Security
PDF
Getting Started with the Node.js LoopBack APi Framework
PPTX
Microsoft Azure Api Management
PPTX
Api management 101
PDF
APIs at Enterprise Scale, Sid Bhatia, API Strategy & Practice Conference, Ams...
PDF
Writing Mobile Apps in the cloud with FeedHenry
PPTX
Azure API Management
PPTX
Azure API Apps
PDF
Application Server-less Web Applications - Serverless Toronto Meetup
PDF
How APIs Can Be Secured in Mobile Environments
PPTX
Azure API Management
PPTX
Deep-Dive: API Security in the Digital Age
PPTX
A Tour of Different API Management Architectures
PDF
Loopback presentation by tineco
PPTX
Gab2015 samir arezki_api management
PDF
RESTful Apps With MongoDB
PDF
AWSSummitDevSecOpsCodeContestReport
PDF
DEV-007_Building Cloud Connected Xamarin Apps
2013 02-apache conna-api-manager-asanka
Azure API Management Update
Best Practices for API Security
Getting Started with the Node.js LoopBack APi Framework
Microsoft Azure Api Management
Api management 101
APIs at Enterprise Scale, Sid Bhatia, API Strategy & Practice Conference, Ams...
Writing Mobile Apps in the cloud with FeedHenry
Azure API Management
Azure API Apps
Application Server-less Web Applications - Serverless Toronto Meetup
How APIs Can Be Secured in Mobile Environments
Azure API Management
Deep-Dive: API Security in the Digital Age
A Tour of Different API Management Architectures
Loopback presentation by tineco
Gab2015 samir arezki_api management
RESTful Apps With MongoDB
AWSSummitDevSecOpsCodeContestReport
DEV-007_Building Cloud Connected Xamarin Apps
Ad

Viewers also liked (20)

PDF
Security enforcement of Java Microservices with Apiman & Keycloak
PDF
Javantura v4 - Keycloak – instant login for your app - Marko Štrukelj
PDF
Having fun with Raspberry(s) and Apache projects
PPTX
Presentation
PPTX
AD Authenticate All The Things
PDF
Openshift v3-a-revolucao-dos-containers-3
PDF
Keycloak で SSO #渋谷java
PDF
Sprint 38 review
PDF
Microservices with WildFly Swarm - JavaSI 2016
PDF
De git à la blockchain
PDF
Five Universal Principles of API Design
PPTX
SFS Parenting with Identity MS
PDF
Writing Java EE microservices using WildFly Swarm
PDF
WildFly Swarm: Criando Microservices com Java EE 7
PDF
WildFly Swarm - Rightsize Your Java EE Apps
PDF
Javantura v4 - What’s NOT new in modular Java - Milen Dyankov
PDF
Free Project Management Templates for Microsoft SharePoint
PDF
Javantura v4 - (Spring)Boot your application on Red Hat middleware stack - Al...
PPT
A Pragmatic Approach to Identity and Access Management
PPTX
Docker Swarm scheduling in 1.12
Security enforcement of Java Microservices with Apiman & Keycloak
Javantura v4 - Keycloak – instant login for your app - Marko Štrukelj
Having fun with Raspberry(s) and Apache projects
Presentation
AD Authenticate All The Things
Openshift v3-a-revolucao-dos-containers-3
Keycloak で SSO #渋谷java
Sprint 38 review
Microservices with WildFly Swarm - JavaSI 2016
De git à la blockchain
Five Universal Principles of API Design
SFS Parenting with Identity MS
Writing Java EE microservices using WildFly Swarm
WildFly Swarm: Criando Microservices com Java EE 7
WildFly Swarm - Rightsize Your Java EE Apps
Javantura v4 - What’s NOT new in modular Java - Milen Dyankov
Free Project Management Templates for Microsoft SharePoint
Javantura v4 - (Spring)Boot your application on Red Hat middleware stack - Al...
A Pragmatic Approach to Identity and Access Management
Docker Swarm scheduling in 1.12
Ad

Similar to Security enforcement of Microservices with API Management (20)

PPTX
API Security using Mulesoft
PPTX
Handling NFRs for the API through OoTB API policies Part-1 | MuleSoft Mysore ...
PDF
Virtual Meetup - API Security Best Practices
PDF
APIConnect Security Best Practice
PDF
Protecting Microservices APIs with 42Crunch API Firewall
PPTX
Gateway/APIC security
PDF
API Security best practices Protect your APIs with Anypoint Platform
PPTX
API Security from the DevOps and CSO Perspectives (Webcast)
PPTX
Best Practices for API Security
PPTX
Toronto Virtual Meetup #5 - API Security and Threats
PDF
API Security Best Practices and Guidelines
PPTX
APIs: The New Security Layer
PPTX
Deep-Dive: Secure API Management
PDF
Guidelines to protect your APIs from threats
PDF
APIsecure 2023 - API Security - doing more with less, Nir Paz (Standard.ai)
PDF
Enhancing your Security APIs
PDF
How To Fix The Most Critical API Security Risks.pdf
PPTX
Mule soft riyadh virtual meetup_30_aug
PDF
5 step plan to securing your APIs
PDF
apidays New York 2023 - Putting yourself out there - how to secure your publi...
API Security using Mulesoft
Handling NFRs for the API through OoTB API policies Part-1 | MuleSoft Mysore ...
Virtual Meetup - API Security Best Practices
APIConnect Security Best Practice
Protecting Microservices APIs with 42Crunch API Firewall
Gateway/APIC security
API Security best practices Protect your APIs with Anypoint Platform
API Security from the DevOps and CSO Perspectives (Webcast)
Best Practices for API Security
Toronto Virtual Meetup #5 - API Security and Threats
API Security Best Practices and Guidelines
APIs: The New Security Layer
Deep-Dive: Secure API Management
Guidelines to protect your APIs from threats
APIsecure 2023 - API Security - doing more with less, Nir Paz (Standard.ai)
Enhancing your Security APIs
How To Fix The Most Critical API Security Risks.pdf
Mule soft riyadh virtual meetup_30_aug
5 step plan to securing your APIs
apidays New York 2023 - Putting yourself out there - how to secure your publi...

More from Charles Moulliard (14)

PDF
Fuse technology-2015
PDF
Continuous Delivery & Integration with JBoss Fuse on Openshift
PDF
Development of social media projects with Apache Camel, Fabric8 & Hawtio
PDF
iPaas with Fuse Fabric Technology
PDF
Make easier Integration of your services with Fuse Solutions - RedHat 2013
PDF
Karaf ee-apachecon eu-2012
PDF
Cloud fuse-apachecon eu-2012
PPT
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
PDF
Fusesource camel-persistence-part2-webinar-charles-moulliard
PDF
Fusesource camel-persistence-part1-webinar-charles-moulliard
PDF
Devoxx 2011 integration-camel-cxf-servicemix-activemq
PDF
Be jug 090611_apacheservicemix
PDF
Fuse source parisjug-10052011
PPT
Apache ServiceMix4 : Dream platform for Java Integration
Fuse technology-2015
Continuous Delivery & Integration with JBoss Fuse on Openshift
Development of social media projects with Apache Camel, Fabric8 & Hawtio
iPaas with Fuse Fabric Technology
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Karaf ee-apachecon eu-2012
Cloud fuse-apachecon eu-2012
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Fusesource camel-persistence-part2-webinar-charles-moulliard
Fusesource camel-persistence-part1-webinar-charles-moulliard
Devoxx 2011 integration-camel-cxf-servicemix-activemq
Be jug 090611_apacheservicemix
Fuse source parisjug-10052011
Apache ServiceMix4 : Dream platform for Java Integration

Recently uploaded (20)

PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Network Security Unit 5.pdf for BCA BBA.
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Reach Out and Touch Someone: Haptics and Empathic Computing
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Building Integrated photovoltaic BIPV_UPV.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
“AI and Expert System Decision Support & Business Intelligence Systems”

Security enforcement of Microservices with API Management