public static NuxeoOAuthConsumer createFromDirectoryEntry(DocumentModel entry, String keyType) throws ClientException { String callbackURL = (String) entry.getProperty(SCHEMA, "callbackURL"); String consumerKey = (String) entry.getProperty(SCHEMA, "consumerKey"); String consumerSecret = (String) entry.getProperty(SCHEMA, "consumerSecret"); String rsaKey = (String) entry.getProperty(SCHEMA, "publicKey"); NuxeoOAuthConsumer consumer = new NuxeoOAuthConsumer(callbackURL, consumerKey, consumerSecret, null); if (OAuth.RSA_SHA1.equals(keyType)) { if (rsaKey != null) { if (rsaKey.contains(PEMReader.PUBLIC_X509_MARKER)) { consumer.setProperty(RSA_SHA1.PUBLIC_KEY, rsaKey); } else { consumer.setProperty(RSA_SHA1.X509_CERTIFICATE, rsaKey); } } } consumer.publicKey = rsaKey; consumer.description = (String) entry.getProperty(SCHEMA, "description"); consumer.signedFetchSupport = (String) entry.getProperty(SCHEMA, "signedFetchSupport"); consumer.dedicatedLogin = (String) entry.getProperty(SCHEMA, "dedicatedLogin"); Boolean enabledFlag = (Boolean) entry.getProperty(SCHEMA, "enabled"); if (Boolean.FALSE.equals(enabledFlag)) { consumer.enabled = false; } Boolean allowBypassVerifierFlag = (Boolean) entry.getProperty(SCHEMA, "allowBypassVerifier"); if (Boolean.TRUE.equals(allowBypassVerifierFlag)) { consumer.allowBypassVerifier = true; } return consumer; }