}
String targetRole = //Authorization.FEDORA_ROLE_KEY + "=" +
dm.callbackRole; // restrict access to role of this
// ticket
String[] targetRoles = {targetRole};
Context context =
ReadOnlyContext.getContext(Constants.HTTP_REQUEST.REST.uri,
request); // , targetRoles);
if (request.getRemoteUser() == null) {
// non-authn: must accept target role of ticket
logger.debug("DatastreamResolverServlet: unAuthenticated request");
} else {
// authn: check user roles for target role of ticket
/*
* logger.debug("DatastreamResolverServlet: Authenticated request
* getting user"); String[] roles = null; Principal principal =
* request.getUserPrincipal(); if (principal == null) { // no
* principal to grok roles from!! } else { try { roles =
* ReadOnlyContext.getRoles(principal); } catch (Throwable t) { } }
* if (roles == null) { roles = new String[0]; }
*/
//XXXXXXXXXXXXXXXXXXXXXXxif (contains(roles, targetRole)) {
logger.debug("DatastreamResolverServlet: user=="
+ request.getRemoteUser());
/*
* if
* (((ExtendedHttpServletRequest)request).isUserInRole(targetRole)) {
* logger.debug("DatastreamResolverServlet: user has required
* role"); } else { logger.debug("DatastreamResolverServlet: authZ
* exception in validating user"); throw new
* AuthzDeniedException("wrong user for this ticket"); }
*/
}
if (logger.isDebugEnabled()) {
logger.debug("debugging backendService role");
logger.debug("targetRole=" + targetRole);
int targetRolesLength = targetRoles.length;
logger.debug("targetRolesLength=" + targetRolesLength);
if (targetRolesLength > 0) {
logger.debug("targetRoles[0]=" + targetRoles[0]);
}
int nSubjectValues = context.nSubjectValues(targetRole);
logger.debug("nSubjectValues=" + nSubjectValues);
if (nSubjectValues > 0) {
logger.debug("context.getSubjectValue(targetRole)="
+ context.getSubjectValue(targetRole));
}
Iterator it = context.subjectAttributes();
while (it.hasNext()) {
String name = (String) it.next();
int n = context.nSubjectValues(name);
switch (n) {
case 0:
logger.debug("no subject attributes for " + name);
break;
case 1:
String value = context.getSubjectValue(name);
logger.debug("single subject attributes for " + name
+ "=" + value);
break;
default:
String[] values = context.getSubjectValues(name);
for (String element : values) {
logger
.debug("another subject attribute from context "
+ name + "=" + element);
}
}
}
it = context.environmentAttributes();
while (it.hasNext()) {
String name = (String) it.next();
String value = context.getEnvironmentValue(name);
logger.debug("another environment attribute from context "
+ name + "=" + value);
}
}
/*