Wednesday, February 19, 2014

OAM 11g PS2 Rest API Characteristics

For those of you attempting to use OAM 11g's Restful API to manage your access policies and wondering about responses for corner cases for creating Host Identifiers, this blog entry is for you.

I've been messing around with Oracle Access Manager's Restful API introduced in their 11g product. At time of posting available documentation was unclear on some behavioral characteristics. So I've captured some of those in this blog. I'm using Apache's HttpClient to generate the HTTP requests routing the traffic through an instance of the WAMulator proxy to capture the content below.

As noted in the title I'm running against 11g PS2. (PS2 means patch set 2 not the game console or the operating system for those old enough to remember it.) Note that the elapsed times are quite slow and Oracle is promising significant improvements by year's end in PS3.

Three responses are captured in this blog: successfully creating a Host Identifier, failure due to a name conflict, and failure due to a DNS host being specified that is already in use by another Host Identifier. Note that some headers have been removed so as not to share information that I don't want to share like the Authorization header. Sorry. Note also that the names and DNS hosts are UUIDs prefixed with the characters "it" which stands for integration test and intentionally do not correlate to real DNS entries.

Successfully Creating a Host Identifier

Creating a new host identifier with a name that does not conflict with an existing host identifier name and has dns hosts that are not already found in an existing host identifier looks like the following when captured by the WAMulator:

 Elapsed Time (ms): 7855
 REQUEST Bytes to SERVER: 762

 Canonical Req. Line: POST /oam/services/rest/11.1.2.0.0/ssa/policyadmin/hostidentifier HTTP/1.1
 Rewritten Req. Line: POST /oam/services/rest/11.1.2.0.0/ssa/policyadmin/hostidentifier HTTP/1.1
 Accept: application/xml
 Content-Type: application/xml
 User-Agent: Java/1.6.0_65
 Host: localhost.lds.org:8080
 Content-Length: 279
 X-Wmltr: handled
 X-Forwarded-Scheme: http

 <?xml version="1.0" ?><HostIdentifier><name>it--2ac02905-ab92-401b-87c5-9d914ce0ce50</name><Hosts><host><hostName>it--dns-da23d9c9-148d-4bc3-b571-1d3ab36385fe</hostName></host><host><hostName>it--dns-405afc94-bdf2-40a2-9552-ebad322b6dbb</hostName></host></Hosts></HostIdentifier>
  
 RESPONSE Bytes to CLIENT: 515
 HTTP/1.1 201 Created
 Date: Wed, 19 Feb 2014 20:56:52 GMT
 Transfer-Encoding: chunked
 Content-Type: text/plain
 Set-Cookie: JSESSIONID=NbJ1TFhJ2p1c9yppQx4mylPRLyGkpQm5k4mcLF1vmvcQtvDZ80dJ!998573338; path=/; HttpOnly
 x-oracle-dms-ecid: 32bcdd031430eb16:-34effd2e:144466504e7:-8000-0000000000014d84
 x-powered-by: Servlet/2.5 JSP/2.1
 Connection: close
 X-ConnId: C-109

 007e 
 http://localhost.lds.org:8080/oam/services/rest/11.1.2.0.0/ssa/policyadmin/hostidentifier?id=a9dcfc7f9f2fe4951bb7286411bd52783
 0000


Failure Due To Duplicate Name


When attempting to create a host identifier with the same name as had by an existing host identifier, namely the one created above, the following response is seen:

 Elapsed Time (ms): 3957
 REQUEST Bytes to SERVER: 684

 Canonical Req. Line: POST /oam/services/rest/11.1.2.0.0/ssa/policyadmin/hostidentifier HTTP/1.1
 Rewritten Req. Line: POST /oam/services/rest/11.1.2.0.0/ssa/policyadmin/hostidentifier HTTP/1.1
 Accept: application/xml
 Content-Type: application/xml
 User-Agent: Java/1.6.0_65
 Host: localhost.lds.org:8080
 Content-Length: 201
 X-Wmltr: handled
 X-Forwarded-Scheme: http

 <?xml version="1.0" ?><HostIdentifier><name>'''it--2ac02905-ab92-401b-87c5-9d914ce0ce50'''</name><Hosts><host><hostName>it--dns-7e612f4f-d8e3-4a65-a5e6-132355049665</hostName></host></Hosts></HostIdentifier>

  
 RESPONSE Bytes to CLIENT: 476
 HTTP/1.1 424 Unknown
 Date: Wed, 19 Feb 2014 20:57:01 GMT
 Transfer-Encoding: chunked
 Content-Type: text/plain
 Set-Cookie: JSESSIONID=kFrBTFhdrp25yMvw2Xw7rQvDy8bxpcGJlWjyWSd34HQ866y6pQlY!998573338; path=/; HttpOnly
 x-oracle-dms-ecid: 32bcdd031430eb16:-34effd2e:144466504e7:-8000-0000000000014d8f
 x-powered-by: Servlet/2.5 JSP/2.1
 Connection: close
 X-ConnId: C-110

 0057
 An object of this type named "it--2ac02905-ab92-401b-87c5-9d914ce0ce50" already exists.
 0000


Failure Due To DNS Host Already In Use


When Creating a new Host Identifier containing a DNS host that is already used in another Host Identifier, namely the one created above, results in the following response:

 Elapsed Time (ms): 4008
 REQUEST Bytes to SERVER: 762

 Canonical Req. Line: POST /oam/services/rest/11.1.2.0.0/ssa/policyadmin/hostidentifier HTTP/
 Rewritten Req. Line: POST /oam/services/rest/11.1.2.0.0/ssa/policyadmin/hostidentifier HTTP/1.1
 Accept: application/xml
 Content-Type: application/xml
 User-Agent: Java/1.6.0_65
 Host: localhost.lds.org:8080
 Content-Length: 279
 X-Wmltr: handled
 X-Forwarded-Scheme: http
 cctx: /{/.../*,*}

 <?xml version="1.0" ?><HostIdentifier><name>it--0bf076e7-c9e2-4275-b57a-ca13de4d52fb</name><Hosts><host><hostName>'''it--dns-da23d9c9-148d-4bc3-b571-1d3ab36385fe'''</hostName></host><host><hostName>it--dns-405afc94-bdf2-40a2-9552-ebad322b6dbb</hostName></host></Hosts></HostIdentifier>


 RESPONSE Bytes to CLIENT: 550
 HTTP/1.1 424 Unknown
 Date: Wed, 19 Feb 2014 20:57:05 GMT
 Transfer-Encoding: chunked
 Content-Type: text/plain
 Set-Cookie: JSESSIONID=P60yTFhBdJLHqjw1QwpssJVTbSwxtpVRpmfwnKlzFgSQdFSThDnm!998573338; path=/; HttpOnly
 x-oracle-dms-ecid: 32bcdd031430eb16:-34effd2e:144466504e7:-8000-0000000000014d96
 x-powered-by: Servlet/2.5 JSP/2.1
 Connection: close
 X-ConnId: C-111

 00a1
 Host "Host hostName:="it--dns-da23d9c9-148d-4bc3-b571-1d3ab36385fe", port=null"" already exists under host identifier "it--2ac02905-ab92-401b-87c5-9d914ce0ce50".
 0000

Yes, that "null" followed by double quotes is how the response comes back. I don't know if Oracle will be fixing that or not. That is it for today. I'll share Tech-To-Do results as they are available. Thanks for reading.



No comments:

Post a Comment