- private static final Logger logger = LoggerFactory.getLogger(AuthProvider.class);
-
- public AuthProvider(IUserManager ium,InputStream privateKeyFileInputStream) throws Exception {
-
- AuthProvider.um = ium;
- if (AuthProvider.um == null){
- throw new Exception("No usermanager service available.");
- }
-
- List<String> roles = new ArrayList<String>(1);
- roles.add(UserLevel.SYSTEMADMIN.toString());
- AuthProvider.um.addLocalUser(new UserConfig(DEFAULT_USER, DEFAULT_PASSWORD, roles));
-
- try {
- PEM = IOUtils.toString(privateKeyFileInputStream);
- } catch (IOException e) {
- logger.error("Error reading RSA key from file.");
- throw new IllegalStateException("Error reading RSA key from file.");
- }
+ public AuthProvider(IUserManager ium, String pemCertificate) throws IllegalArgumentException, IOException {
+ checkNotNull(pemCertificate, "Parameter 'pemCertificate' is null");
+ checkNotNull(ium, "No user manager service available.");
+ this.um = ium;
+ pem = pemCertificate;