OSLC workshop (Access RM programmatically) : Error 417, Expectation Failed during form based authentication.
Hi,
I am running the OSLC Workshop and trying to run example03.java net.jazz.oslc.consumer.rm.client package.
I am running it against 6.0.6.1 and iFix017
The form based authentication post query return Error 417, Expectation failed at line179 as shown below. Is this a issue with form based authentication, if yes how to get rid of it?
Output log of the execution:
>> Example03: Print out the content of the Service Providers catalog
- Root Services URI: https://aeroclm.honeywell.com/rm/rootservices
- Service Providers catalog XPath expression: /rdf:Description/oslc_rm:rmServiceProviders/@rdf:resource
- Service Provider title XPath expression: //oslc:ServiceProvider/dcterms:title
- Login: XXXXX
- Password: XXXX
>> GET(1) https://aeroclm.honeywell.com/rm/rootservices
>> Response Headers:
- Date: Wed, 24 Nov 2021 07:34:33 GMT
- Server: Apache
- Strict-Transport-Security: max-age=31536000
- ETag: "gknF/vzdWmHdxB4rzsSKaXvC7dE="
- Expires: Wed, 24 Nov 2021 07:39:33 GMT
- Cache-Control: public
- Content-Type: application/rdf+xml; charset=UTF-8
- Content-Language: en-US
- Keep-Alive: timeout=5, max=86
- Connection: Keep-Alive
- Transfer-Encoding: chunked
- Strict-Transport-Security: max-age=157680000
>> GET(1) https://aeroclm.honeywell.com/rm/oslc_rm/catalog
Nov 24, 2021 1:04:43 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: jfs-request-token-843b7728b2f545da811551f0de556cab="EUoIwSfRo532nvIEMdDCPTNaUo5dbitZ8Xsyz2q6g"; Version=1; Max-Age=600; Expires=Wed, 24-Nov-2021 07:44:43 GMT; Path=/rm; secure; HttpOnly". Unable to parse expires attribute: Wed
>> Response Headers:
- Date: Wed, 24 Nov 2021 07:34:43 GMT
- Server: Apache
- Strict-Transport-Security: max-age=31536000
- X-com-ibm-team-repository-web-auth-msg: authrequired
- X-XSS-Protection: 1; mode=block
- Content-Type: text/html; charset=UTF-8
- Content-Language: en-US
- Expires: Thu, 01 Dec 1994 16:00:00 GMT
- Cache-Control: no-cache="set-cookie, set-cookie2"
- Set-Cookie: JazzFormAuth=Form; Path=/jts; Secure
- Keep-Alive: timeout=5, max=40
- Connection: Keep-Alive
- Transfer-Encoding: chunked
- Strict-Transport-Security: max-age=157680000
>> POST https://aeroclm.honeywell.com/jts/j_security_check
- Date: Wed, 24 Nov 2021 07:35:29 GMT
- Server: Apache
- Content-Length: 312
- Connection: close
- Content-Type: text/html; charset=iso-8859-1
- Strict-Transport-Security: max-age=157680000
org.apache.http.auth.InvalidCredentialsException: Authentication failed
at net.jazz.oslc.utils.HttpUtils.doRRCOAuth(HttpUtils.java:232)
at net.jazz.oslc.utils.HttpUtils.sendGetForSecureDocument(HttpUtils.java:264)
at examples.Example03.main(Example03.java:92)
One answer
I've never tried what you're doing, but the message "org.apache.http.auth.InvalidCredentialsException: Authentication failed" would seem to indicate that the credentials you're using aren't valid.
Comments
I do not see the body with the username or password. I would in general suggest to use Postman or RESTclient to test if there is an issue with authentication. See https://rsjazz.wordpress.com/2019/05/13/using-a-rest-client-to-authenticate-to-elm-clm-applications/
Hi Ralph Schoon, Following is the snippet from the example.03 from oslc workshop. Here the username and password are added. While debugging the status error code shows 417. is anything missing in the HTTP post?
The username and the password would be in the variable login and the password in the password. This is not shown here and would cause the issue if done incorrectly. I have not done the workshop, so I can not comment on anything. In the stack trace your username has an X more than the password..........
Hi Ralph Schoon, In the log, i have replaced username and password to X`s just to hide it.
Ian Bernard I tried with valid username and password. Also authentication works in postman App. the OSLC workshop code is not working. Have you worked on the java code for authentication, if yes please share it.
Just because you get a 200 does not mean you are successfully logged in. Redirect and response headers play a role. We already shored links with information. Unfortunately this is not easy....