Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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:

// 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

0 votes



2 answers

Permanent link
Check out:
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Appendix_A

0 votes


Permanent link
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?

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Feb 25 '10, 1:30 p.m.

Question was seen: 9,298 times

Last updated: Feb 25 '10, 1:30 p.m.

Confirmation Cancel Confirm