use of org.irods.jargon.ticket.TicketServiceFactory in project metalnx-web by irods-contrib.
the class TicketClientServiceImpl method setUpAccess.
/**
* Sets up all necessary stuff for an anonymous user to be able to interact with the grid. This interaction means
* iput & iget.
*/
private void setUpAccess() {
try {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null || !(authentication.getDetails() instanceof UserTokenDetails)) {
logger.warn("Accessing files and collections with tickets using anonymous account");
irodsAccount = IRODSAccount.instanceForAnonymous(host, port, ANONYMOUS_HOME_DIRECTORY, zone, RESOURCE);
} else {
logger.warn("Accessing files and collections with tickets as authenticated user");
irodsAccount = ((UserTokenDetails) authentication.getDetails()).getIrodsAccount();
}
TicketServiceFactory ticketServiceFactory = new TicketServiceFactoryImpl(irodsAccessObjectFactory);
ticketClientOperations = ticketServiceFactory.instanceTicketClientOperations(irodsAccount);
} catch (JargonException e) {
logger.error("Could not set up anonymous access");
}
}
use of org.irods.jargon.ticket.TicketServiceFactory in project metalnx-web by irods-contrib.
the class IRODSServicesImpl method getTicketAdminService.
@Override
public TicketAdminService getTicketAdminService() throws DataGridConnectionRefusedException {
TicketAdminService tas = null;
try {
TicketServiceFactory tsf = new TicketServiceFactoryImpl(irodsAccessObjectFactory);
tas = tsf.instanceTicketAdminService(irodsAccount);
} catch (JargonException e) {
logger.error("Could not instantiate ticket admin service: ", e.getMessage());
if (e.getCause() instanceof ConnectException) {
throw new DataGridConnectionRefusedException(e.getMessage());
}
}
return tas;
}
Aggregations