OAuth access token with Form-based Authentication

Hi,
I am trying to retrieve the OAuth token using the form-based authentication as follows:
https://localhost:9443/jazz/j_security_check?j_username=external&j_password=external
However, it appears that the server is not returning all the correct headers and parameters to be used.
I'm using JFS 1.0.0.2 and the same SDK version.
I first send a HttpGet request to the server to check the current user:
Then I check to see if authentication is required and send the form-based authentication:
After the second HttpGet request to authenticate the user (username:external, password:external), these are the headers that I receive back from the server:
I believe that "set-cookie" should be one of the headers that get returned after trying to retrieve the OAuth access token using the form-based authentication, correct?
Did I miss something in the code or concept?
Thanks in advance,
Tip
I am trying to retrieve the OAuth token using the form-based authentication as follows:
https://localhost:9443/jazz/j_security_check?j_username=external&j_password=external
However, it appears that the server is not returning all the correct headers and parameters to be used.
I'm using JFS 1.0.0.2 and the same SDK version.
I first send a HttpGet request to the server to check the current user:
// Check the current user service
HttpGet method = new HttpGet("https://localhost:9444/mcif/selfcheck/user?currentUser=true");
HttpResponse resp = httpClient.execute(method);
Then I check to see if authentication is required and send the form-based authentication:
// Check response header to see if authentication is required
Header[] headers = resp.getHeaders("X-com-ibm-team-repository-web-auth-msg");
for (Header header : headers) {
System.out.println("\t" + header.getName() + " : " + header.getValue());
if (header.getName().equalsIgnoreCase("X-com-ibm-team-repository-web-auth-msg")) {
if (header.getValue().equalsIgnoreCase("authrequired")) {
System.out.println("auth required");
method= new HttpGet(https://localhost:9443/jazz/j_security_check?j_username=external&j_password=external);
resp = httpClient.execute(method);
}
}
}
After the second HttpGet request to authenticate the user (username:external, password:external), these are the headers that I receive back from the server:
Server : Apache-Coyote/1.1
Cache-Control : private
Expires : Wed, 31 Dec 1969 16:00:00 PST
Content-Type : text/html;charset=UTF-8
Content-Length : 2402
Date : Thu, 25 Feb 2010 18:16:25 GMT
I believe that "set-cookie" should be one of the headers that get returned after trying to retrieve the OAuth access token using the form-based authentication, correct?
Did I miss something in the code or concept?
Thanks in advance,
Tip
2 answers

Hi,
I am trying to retrieve the OAuth token using the form-based authentication as follows:
https://localhost:9443/jazz/j_security_check?j_username=external&j_password=external
However, it appears that the server is not returning all the correct headers and parameters to be used.
I'm using JFS 1.0.0.2 and the same SDK version.
I first send a HttpGet request to the server to check the current user:
// Check the current user service
HttpGet method = new HttpGet("https://localhost:9444/mcif/selfcheck/user?currentUser=true");
HttpResponse resp = httpClient.execute(method);
Then I check to see if authentication is required and send the form-based authentication:
// Check response header to see if authentication is required
Header[] headers = resp.getHeaders("X-com-ibm-team-repository-web-auth-msg");
for (Header header : headers) {
System.out.println("\t" + header.getName() + " : " + header.getValue());
if (header.getName().equalsIgnoreCase("X-com-ibm-team-repository-web-auth-msg")) {
if (header.getValue().equalsIgnoreCase("authrequired")) {
System.out.println("auth required");
method= new HttpGet(https://localhost:9443/jazz/j_security_check?j_username=external&j_password=external);
resp = httpClient.execute(method);
}
}
}
After the second HttpGet request to authenticate the user (username:external, password:external), these are the headers that I receive back from the server:
Server : Apache-Coyote/1.1
Cache-Control : private
Expires : Wed, 31 Dec 1969 16:00:00 PST
Content-Type : text/html;charset=UTF-8
Content-Length : 2402
Date : Thu, 25 Feb 2010 18:16:25 GMT
I believe that "set-cookie" should be one of the headers that get returned after trying to retrieve the OAuth access token using the form-based authentication, correct?
Did I miss something in the code or concept?
Thanks in advance,
Tip
Hi,I have met the same problem with you, Have you solve this problem? My problem is: when I run my code on jazz with the jetty server,it works well,but we I deploy it on the JazzTeamServer,the problem comes out;JazzTeamServer is based on Tomcat.Can not find the ("X-com-ibm-team-repository-web-auth-msg".Maybe it something wrong with different server?