Package com.elpical.jclaro.admin.ws.server
package com.elpical.jclaro.admin.ws.server
AdministrationConnector can be used to configure and administer Claro. The WebService is available as SOAP webservice using the Java JAX-WS WebService framework.
The WebService is available on the Claro Server via the URL: http://hostname:port_nr/AdminConnector/AdminConnector?WSDL
Examples are available from the e-learning site
Java client code can be easily generated from the WSDL using the Java wsimport tool:
wsimport -d . -s . -extension -p com.elpical.jclaro.admin.ws.client http://hostname:port_nr/AdminConnector/AdminConnector?WSDL
The client classes are also available in the ClaroAdministration.jar in the lib folder of Claro which can be added to the classpath:
java -cp .:lib/ClaroAdministration.jar com.elpical.jclaro.admin.example.client.ExampleAdminClient
To be able to make use of the WebService methods one first has to acquire a unique login id. Depending on whether users are configured in Claro you have to login using this user or use an empty username and password as value if no users are configured. For login the WebService makes use of asymetric encryption (RSA) of the password to prevent that the password can easily be retrieved via sniffing the network traffic.
Steps to login into Claro
1. Retrieve the public encryption key from the server. This key is used to encrypt passwords send from the client to the server:
byte [] claroPublicKey=claroAdministration.getPublicKey();
2. The client logs into the WebService:
Account account=claroAdministration.login(String name, byte[] encryptedPassword, byte[] publicKey);
The client uses in this method the arguments name: The name of the user to login or if no user-management is used null or a fake name, encryptedPassword which is the password of the user encrypted using the public key from the server and as third argument the public key from the client. This public key from the client is used to encrypt the logintoken send back to the client. In the next communication with the server this decrypted token on the client side is encrypted again with the server public key in the next communication with the server as validation. For now only passwords and tokens are encrypted using this method, but can be used in the future also for other sensitive information.
The WebService is available on the Claro Server via the URL: http://hostname:port_nr/AdminConnector/AdminConnector?WSDL
Examples are available from the e-learning site
Java client code can be easily generated from the WSDL using the Java wsimport tool:
wsimport -d . -s . -extension -p com.elpical.jclaro.admin.ws.client http://hostname:port_nr/AdminConnector/AdminConnector?WSDL
The client classes are also available in the ClaroAdministration.jar in the lib folder of Claro which can be added to the classpath:
java -cp .:lib/ClaroAdministration.jar com.elpical.jclaro.admin.example.client.ExampleAdminClient
To be able to make use of the WebService methods one first has to acquire a unique login id. Depending on whether users are configured in Claro you have to login using this user or use an empty username and password as value if no users are configured. For login the WebService makes use of asymetric encryption (RSA) of the password to prevent that the password can easily be retrieved via sniffing the network traffic.
Steps to login into Claro
1. Retrieve the public encryption key from the server. This key is used to encrypt passwords send from the client to the server:
byte [] claroPublicKey=claroAdministration.getPublicKey();
2. The client logs into the WebService:
Account account=claroAdministration.login(String name, byte[] encryptedPassword, byte[] publicKey);
The client uses in this method the arguments name: The name of the user to login or if no user-management is used null or a fake name, encryptedPassword which is the password of the user encrypted using the public key from the server and as third argument the public key from the client. This public key from the client is used to encrypt the logintoken send back to the client. In the next communication with the server this decrypted token on the client side is encrypted again with the server public key in the next communication with the server as validation. For now only passwords and tokens are encrypted using this method, but can be used in the future also for other sensitive information.
package com.elpical.jclaro.admin.example.client;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.URL;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.List;
import javax.crypto.Cipher;
import javax.xml.namespace.QName;
import com.elpical.jclaro.admin.ws.client.Account;
import com.elpical.jclaro.admin.ws.client.AdminChannel;
import com.elpical.jclaro.admin.ws.client.AdminConnector;
import com.elpical.jclaro.admin.ws.client.AdminConnectorService;
public class ExampleAdminClient {
public ExampleAdminClient(String[] args) throws Exception {
String ip;
String port;
String user;
String password;
if (args != null && args.length == 4) {
ip = args[0];
port = args[1];
user = args[2];
password = args[3];
} else {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("connect to host: ");
ip = reader.readLine();
System.out.print("port nr: ");
port = reader.readLine();
System.out.print("username: ");
user = reader.readLine();
System.out.print("password: ");
password = reader.readLine();
}
System.out.println("\nConnecting to : http://" + ip + ":" + port + "/AdminConnector/AdminConnector?WSDL"); System.out.println("username/password: " + user + "/" + password);
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(1024); KeyPair pair = keyGen.generateKeyPair(); PrivateKey privateKey = pair.getPrivate(); PublicKey publicKey = pair.getPublic(); ByteArrayOutputStream out = new
ByteArrayOutputStream(); ObjectOutputStream stream = new ObjectOutputStream(out); stream.writeObject(publicKey);
byte[] clientPublicKeyBytes = out.toByteArray();
URL url = new URL(new URL("http://" + ip + ":" + port), "AdminConnector/AdminConnector?WSDL");
AdminConnectorService service = new AdminConnectorService(url, new QName("http://server.ws.admin.jclaro.elpical.com/", "AdminConnectorService"));
AdminConnector connector = service.getAdminConnectorPort();
byte[] serverPublicKeyBytes = connector.getPublicKey();
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(serverPublicKeyBytes));
PublicKey serverPublicKey = (PublicKey) in.readObject();
final Cipher encryptCipher = Cipher.getInstance("RSA");
encryptCipher.init(Cipher.ENCRYPT_MODE, serverPublicKey);
byte[] encryptedPassword = new byte[0];
if (password != null && password.length() > 0) {
encryptedPassword = encryptCipher.doFinal(password.getBytes());
}
Account account = connector.login(user, encryptedPassword, clientPublicKeyBytes);
if (account == null) { throw new Exception("Login Error"); }
final Cipher decryptCipher = Cipher.getInstance("RSA");
decryptCipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] loginToken = decryptCipher.doFinal(account.getEncryptedToken());
System.out.println("Succesfull login. Encrypted login token: " + new String(account.getEncryptedToken() + " Decrypted login token: " + new String(loginToken)));
byte[] encryptedToken = encryptCipher.doFinal(loginToken);
System.out.println("Ask for list of channels with encrypted token: " + new String(encryptedToken));
List<AdminChannel> channels = connector.getChannels(encryptedToken);
for (AdminChannel adminChannel : channels) {
System.out.println("Channel: " + adminChannel.getName());
}
}
public static void main(String[] args) {
try {
new ExampleAdminClient(args);
} catch (Exception e) {
e.printStackTrace();
}
}
}
-
Class SummaryClassDescriptionThe Account class holds information about the privileges an account has and a login token to be used in communication with the server.Utility class to improve the performance of the webservices: - Administrator - Inspector - JobClient NOTE: Each webservice needs a copy of this class because of the specialized class Account in every webservice...SYNOPSIS: Represents the ClaroAccountToken entity type in this webservice.Entrance point for Claro Administration WebServicesThis class holds some general Channel Attributes available to all types of ChannelsClass to hold general Channel Info.Condition class used for settings in a RoutingChannel.Class with specific DeviceLink settingsclass used in RoutingChannel to hold Else settingsClass holds information about access to the SMTP Email serverClass holds settings to be used for routing images based on Google Vision AIClass to hold the result from Google Vision AI after image has been processedClass holds settings concerning grayscale conversions/settings and dotgain conversionClass to group Channels logically togetherClass used for internal administrationClass with settings concerning ImageEnhancementInput Class holds various settings related to the input folder of a channelHolds information about Inspector jobs waiting in the Inspector queueHolds licensing informationHolds the special options valid for the LicenseInformation about various aspects of the licenseClass holds information about a single log messageClass which hold information about network cards in the system.Holds output related settingsSpecific PDF processing parametersHolds all settings concerning a Processing ChannelHolds settings about purging actions of a Purging ChannelHolds all Settings in a Purging ChannelHolds information about when to reject images based on quality valuesClass used in listing files on remote (Claro) serverClass which holds all settings for a Routing ChannelClass which holds all size related settingsClass which holds information about the system in relation to licensingClass holds information about Task settingsClass which holds information of the Claro version in useClass which holds workflow settings
-
Exception SummaryExceptionDescriptionException thrown after supplying wrong login informationException is thrown if a user tries to use a function for which he or she has no privileges