API Management : Securing APIs thanks to an API Manager

Mechanisms for securing APIs


API Oriented Architecture : User Context relocation

What existed before : user session

Recall : the monolith


In the monolith, every thing is protected on the server

Application Server
Application Server
Application
appli-v2.0
Application...
Application User
Application User
Browser
html/js
Browser...
HTTP Traffic
HTTP Traffic
Server
Server
View
View
Controller
Controller
Legend
Legend
Model
Model
Viewer does not support full SVG 1.1
x

API Oriented Architecture : User Context relocation(2)


Now with API Oriented Architecture:

API Oriented Architecture : Security Strategies

There is mainly only one general strategy : token based

OIDC

OIDC : About tokens

OIDC : Direct Access Grant Flow


Authentication
Authentication
federates
federates
federates
federates
get tokens
get tokens
Authorization Server
OIDC Provider
Authorization Server...
logs in
logs in
uses
uses
User
User
Front-end 1
Relying Party
Front-end 1...
checks authentication
checks authentication
API Gateway
Resource Server
API Gateway...
Service REST
(Endpoint)
Service REST...
Identity
Provider
Identity...
Service REST
(Endpoint)
Service REST...
Service REST
(Endpoint)
Service REST...
Service REST
(Endpoint)
Service REST...
Back-end
Service provider
Back-end...
dispatches
dispatches
Directory
Directory
2
2
1
1
4
4
5
5
6
6
7
7
3
3
Viewer does not support full SVG 1.1

OIDC in practice with an Authorization Server


Authorization Server
OIDC Token Provider
Authorization Server...
 Realm 1
 Realm 1
client1
client1
client2
client2
conf1
conf1
conf2
conf2
user federation
user federa...
external provider
1
external pr...
external provider
2
external pr...
External
provider 3
External...
 Realm 2
 Realm 2
client1
client1
client2
client2
conf1
conf1
conf2
conf2
user federation
user federa...
obtain token
 realm / client / user
obtain t...
access_token & refresh_token
access_t...
1
1
2
2
3
3
4
4
5
5
Viewer does not support full SVG 1.1

OIDC : integration with API Manager

API Gateway
Resources Server
API Gateway...
Organization 1
Organization 1
Public API
Public API
Private API
Private API
Private API
Private API
Client App
api-key
Client App...
Policies      
Policies      
Policies      
Policies      
to back-end
to back-end
to back-end
to back-end
to back-end
to back-end
Organization 2
Organization 2
IP whitelist
IP whitelist
oidc
oidc
CORS
CORS
...
...
from front-end
from front-end
from front-end
from front-end
1
1
2
2
3
3
4
4
5
5
6
6
7
7
9
9
8
8
Viewer does not support full SVG 1.1

Network Isolation

In order to isolate and to protect back-end API which can be weakly protected (thanks to API Gateway mediation), this kind of architecture can be found

DMZ
DMZ
Public
Public
Intra
Intra
Apache Server
Apache Server
Front-end
Front-end
User
User
Browser
js/xhr
Browser...
Application Server
Application Server
Back-end
Back-end
API
API
Trafic HTTP
Trafic HTTP
Serveur
Serveur
Legend
Legend
token check
token check
API Gateway
API Gateway
dispatches 
user call
dispatches...
APIManager
APIManager
Authorization
Server
Authorization...
Viewer does not support full SVG 1.1

Exercise

Setup a realm in keycloak to secure your API on APIMan