Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Crowd Integration

Marcos Martin March 12, 2015

I am integrating my custom application with crowd but i don't understant why the method getUser don't give me answer.

It's so strange because i can get the user token with the CrowdHttpAuthenticator and print but after execute the method getUser don't print me anything .

My Code:

crowdClient = new com.atlassian.crowd.integration.rest.service.factory.RestCrowdClientFactory().newInstance(clientProperties);
System.out.println("crowdClient -> " + crowdClient);
crowdHttpAuthenticator = new CrowdHttpAuthenticatorImpl(crowdClient, 
clientProperties, 
CrowdHttpTokenHelperImpl.getInstance(
CrowdHttpValidationFactorExtractorImpl.getInstance()));
System.out.println("crowdHttpAuthenticator -> " + crowdHttpAuthenticator);
String token2 = crowdHttpAuthenticator.getToken(requestCrowd);
System.out.println("crowdHttpAuthenticator token2: -> " + token2);
boolean isAuthenticated =
crowdHttpAuthenticator.isAuthenticated(requestCrowd, responseCrowd);
System.out.println("crowdHttpAuthenticator isAuthenticated: -> " + isAuthenticated);
User user = crowdHttpAuthenticator.getUser(requestCrowd);
System.out.println("crowdHttpAuthenticator:::" + user.getExternalId());

Console output:

crowdClient -> com.atlassian.crowd.integration.rest.service.RestCrowdClient@aed92a1
crowdHttpAuthenticator -> com.atlassian.crowd.integration.http.CrowdHttpAuthenticatorImpl@aee0dd4
crowdHttpAuthenticator token2: -> kf4eSUUCRENSypA4xpIP5w00
crowdHttpAuthenticator isAuthenticated: -> false

 

The code never do System.out.println("crowdHttpAuthenticator:::" + user.getExternalId()); and dont print any error trace.

Please give me some ideas. 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Caspar Krieger
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 15, 2015

It sounds like the expression crowdHttpAuthenticator.getUser(requestCrowd) is throwing an exception and getting caught in a catch block up the stack. Try explicitly wrapping it in a try catch block:

try {
    User user = crowdHttpAuthenticator.getUser(requestCrowd);
    System.out.println("crowdHttpAuthenticator:::" + user.getExternalId());
} catch (Throwable t) {
    t.printStackTrace();
}
TAGS
AUG Leaders

Atlassian Community Events