Hello,
Someone in this list could tell me how can I authenticate my service to get
something under CAS??
Example: I have a service A that is under CAS (just logged users can access)
and I have a service B that want access service A. When I try get service A
from service B, it returns the CAS Login page.
I've tried it using Apache HttpClient with Digest authentication.
This is my code:
public static String callService(String endPoint, String parameters) {
String result = "";
DefaultHttpClient httpClient = new DefaultHttpClient();
String url = "http://geotech97:21897/Test";
// List authPrefs = new ArrayList(1);
// authPrefs.add(AuthPolicy.DIGEST);
//
httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,
authPrefs);
httpClient.getCredentialsProvider().setCredentials(
new AuthScope("geotech97", 21898),
new UsernamePasswordCredentials("joe", "joe"));
HttpGet httpget = new HttpGet(url);
HttpResponse response;
try {
response = httpClient.execute(httpget);
HttpEntity entity = response.getEntity();
if (entity != null) {
StringBuilder stringBuilder = new StringBuilder();
String line;
InputStream input = entity.getContent();
try {
BufferedReader reader = new BufferedReader(new
InputStreamReader(input, "UTF-8"));
while ((line = reader.readLine()) != null) {
stringBuilder.append(line).append("\n");
}
} finally {
input.close();
}
result = stringBuilder.toString();
}
} catch (IOException ex) {
Logger.getLogger(HttpServiceClient.class.getName()).log(Level.SEVERE, null,
ex);
}
httpClient.getConnectionManager().shutdown();
return result;
}
Should I do a diferent configuration to login using code?? Or uses another
way for authentication
--
You are currently subscribed to [email protected] as:
[email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/cas-user