...
Table of Contents | ||
---|---|---|
|
...
Credentials Service Provider
Panel | ||||
---|---|---|---|---|
| ||||
The following applies to XperienCentral versions 10.19 and higher. |
In a standard installation, XperienCentral users are managed in the Authorization component. Along with the Authorization component, there are two types of credentials sets that are not targeted at the editorial tasks but are infrastructure-related. By default these credential sets are managed by the following properties in the XperienCentral Setup Tool (General tab):
These credentials sets are for:
internal_http_authentication_password / internal_http_authentication_username
needed forinternal_http_use_authentication
orinternal_http_use_form_authentication
http_proxy_username /
http_proxy_password
needed forhttp_use_proxy
Because these credentials sets can be managed in an organizational credential storage system external to XperienCentral, you can create an integration with this thereby removing the need to fill in these credential properties in the Setup Tool.
This can be accomplished via your own integration component by creating a plugin that implements the Credentials Service Provider. When there is no plugin active that implements the credentials services, a look-up is done on the settings internal_http_use_authentication
or internal_http_use_form_authentication
in the "application_settings" section in the General tab of the Setup Tool. If a plugin is active that implements the XperienCentral credentials service, the username/password combination from the plugin is used to authorize the user.
When a credentials provider plugin is created, the service in the activator needs to implement the CredentialsProviderService and CredentialsProvider classes. The following is an example implementation of a credential provider.
Code Block | ||
---|---|---|
| ||
import nl.gx.webmanager.services.credentials.CredentialsProviderService;
public class ExampleCredentialsProviderServiceImpl extends SimpleServiceComponent implements ExampleCredentialsProviderService {
protected static final Logger LOG = Logger.getLogger(ExampleCredentialsProviderServiceImpl.class.getName());
private final static String USERNAME = "test";
private final static String PASSWORD = "test";
/**
* {@inheritDoc}
*/
public Credentials getCredentials(String identifier) {
LOG.log(Level.INFO,"Returning username/password test/test as example credentials for identifier '" + identifier + "'");
if (identifier.equalsIgnoreCase(CredentialsProviderService.INTERNAL_HTTP_REQUESTS_CREDENTIALS_IDENTIFIER) {
// Integrate here with some type of storage for credential sets. For now..
return new CredentialsImpl(identifier, USERNAME, PASSWORD);
} else if (identifier.equalsIgnoreCase(CredentialsProviderService.HTTP_PROXY_CREDENTIALS_IDENTIFIER) {
// Integrate here with some type of storage for credential sets. For now..
return new CredentialsImpl(identifier, USERNAME, PASSWORD);
} else {
// For credentials used in custom configuration sets you can identity your own identifiers and capture
// them here. For now..
return new CredentialsImpl(identifier, USERNAME, PASSWORD);
}
} |
Note that other credential sets that are infrastructure-related that are not already covered via the ones above can also be run though the credential provider logic, however in this case you need to accommodate this yourself. For example:
Code Block | ||||
---|---|---|---|---|
| ||||
import nl.gx.webmanager.services.credentials.CredentialsProviderService;
public class SomeClassThatNeedsTheCustomCredentialsSet {
....
OwnedConfigurationService myOwnedConfigurationService;
private final static String CREDENTIAL_IDENTIFIER = "someCredentialSetIdentier";
public void doSomething() {
String username, password;
CustomCredenentials someCustomCredentials = myCredentialsProviderService.getCredentials(CREDENTIAL_IDENTIFIER);
if (someCredentials == null) {
username = myOwnedConfigurationService.getUsername();
password = myOwnedConfigurationService.getPassword();
} else {
username = someCustomCredentials.getUsername();
password = someCustomCredentials.getPassword();
}
// Use the credentials
....
}
} |
...
Property Editors
Property Editors are used to facilitate conversions between a complex type and String. Posted values from a HTML form will usually be converted to a String by the servlet engine. Spring MVC offers a way to convert incoming Strings to complex types; it also converts complex types to Strings when the response is sent back to the browser. Spring MVC offers this functionality through the Property Editors. The Spring MVC and the XperienCentral platforms already have a few default Property Editors for the next types:
...