本文整理汇总了Java中org.kuali.rice.core.api.security.credentials.CredentialsSource类的典型用法代码示例。如果您正苦于以下问题:Java CredentialsSource类的具体用法?Java CredentialsSource怎么用?Java CredentialsSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CredentialsSource类属于org.kuali.rice.core.api.security.credentials包,在下文中一共展示了CredentialsSource类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CredentialsOutHandler
import org.kuali.rice.core.api.security.credentials.CredentialsSource; //导入依赖的package包/类
public CredentialsOutHandler(final CredentialsSource credentialsSource,
final ServiceConfiguration serviceConfiguration) {
Assert.notNull(credentialsSource, "credentialsSource cannot be null.");
Assert.notNull(serviceConfiguration, "serviceConfiguration cannot be null.");
this.credentialsSource = credentialsSource;
this.serviceConfiguration = serviceConfiguration;
final Credentials credentials = this.credentialsSource
.getCredentials(this.serviceConfiguration.getEndpointUrl().toString());
Assert.isTrue(credentials instanceof UsernamePasswordCredentials,
"Credentials must be of type usernamepassword.");
final UsernamePasswordCredentials c = (UsernamePasswordCredentials) credentials;
setProperty(WSHandlerConstants.USER, c.getUsername());
}
示例2: registerTestCredentialsSourceFactory
import org.kuali.rice.core.api.security.credentials.CredentialsSource; //导入依赖的package包/类
/**
* Registers a CredentialsSourceFactory with our ConfigContext. Needed to verify that services requiring basic auth
* work.
*/
private void registerTestCredentialsSourceFactory() {
List<CredentialsSource> credentialsSources =
Collections.<CredentialsSource>singletonList(
new UsernamePasswordCredentialsSource("gilesp", "thuperthecret"));
CredentialsSourceFactory credentialsSourceFactory = new CredentialsSourceFactory();
credentialsSourceFactory.setCredentialsSources(credentialsSources);
try {
credentialsSourceFactory.afterPropertiesSet();
} catch (Exception e) {
throw new RiceRuntimeException(e);
}
ConfigContext.getCurrentContextConfig().putObject(Config.CREDENTIALS_SOURCE_FACTORY, credentialsSourceFactory);
}
示例3: AuthenticationCommonsHttpInvokerRequestExecutor
import org.kuali.rice.core.api.security.credentials.CredentialsSource; //导入依赖的package包/类
/**
* Constructor that accepts the CredentialsSource and Service Info.
*
* @param httpClient the http client
* @param credentialsSource the source of credentials.
* @param serviceConfiguration the service configuration.
*/
public AuthenticationCommonsHttpInvokerRequestExecutor(final HttpClient httpClient,
final CredentialsSource credentialsSource, final ServiceConfiguration serviceConfiguration) {
super(httpClient);
Assert.notNull(credentialsSource, "credentialsSource cannot be null.");
Assert.notNull(serviceConfiguration, "serviceConfiguration cannot be null.");
this.credentialsSource = credentialsSource;
this.serviceConfiguration = serviceConfiguration;
}
示例4: AuthenticationCommonsHttpInvokerRequestExecutor
import org.kuali.rice.core.api.security.credentials.CredentialsSource; //导入依赖的package包/类
/**
* Constructor that accepts the CredentialsSource and Service Info.
*
* @param credentialsSource the source of credentials.
* @param serviceInfo information about the service.
*/
public AuthenticationCommonsHttpInvokerRequestExecutor(final HttpClient httpClient,
final CredentialsSource credentialsSource, final ServiceConfiguration serviceConfiguration) {
super(httpClient);
Assert.notNull(credentialsSource, "credentialsSource cannot be null.");
Assert.notNull(serviceConfiguration, "serviceConfiguration cannot be null.");
this.credentialsSource = credentialsSource;
this.serviceConfiguration = serviceConfiguration;
}
示例5: setCredentialsSource
import org.kuali.rice.core.api.security.credentials.CredentialsSource; //导入依赖的package包/类
public void setCredentialsSource(final CredentialsSource credentialsSource) {
this.credentialsSource = credentialsSource;
}
示例6: getCredentialsSource
import org.kuali.rice.core.api.security.credentials.CredentialsSource; //导入依赖的package包/类
protected CredentialsSource getCredentialsSource() {
return this.credentialsSource;
}
示例7: getServiceConnector
import org.kuali.rice.core.api.security.credentials.CredentialsSource; //导入依赖的package包/类
public static ServiceConnector getServiceConnector(
final ServiceConfiguration serviceConfiguration) {
final CredentialsSourceFactory credentialsSourceFactory = (CredentialsSourceFactory) ConfigContext
.getCurrentContextConfig().getObjects()
.get(Config.CREDENTIALS_SOURCE_FACTORY);
final CredentialsSource credentialsSource = credentialsSourceFactory != null ? credentialsSourceFactory
.getCredentialsForType(serviceConfiguration.getCredentialsType()) : null;
ServiceConnector serviceConnector = null;
if (serviceConfiguration.getCredentialsType() != null && credentialsSource == null) {
throw new RiceRuntimeException("Service requires credentials but no factory or CredentialsSource could be located.");
}
String alternateEndpoint = determineAlternateEndpoint(serviceConfiguration);
URL alternateEndpointUrl = null;
if (!StringUtils.isBlank(alternateEndpoint)) {
try {
alternateEndpointUrl = new URL(alternateEndpoint);
} catch (MalformedURLException e) {
throw new IllegalStateException("Encountered invalid alternate endpoint url: " + alternateEndpoint, e);
}
}
// TODO switch this to use serviceConfiguration.getType() at some point in the future and allow for
// this to be easily "pluggable" with new connector types
//
// if set in local mode then preempt any protocol connectors
if (ConfigContext.getCurrentContextConfig().getDevMode()) {
serviceConnector = new BusLocalConnector(serviceConfiguration);
} else if (serviceConfiguration instanceof JavaServiceConfiguration) {
serviceConnector = new HttpInvokerConnector((JavaServiceConfiguration) serviceConfiguration, alternateEndpointUrl);
} else if (serviceConfiguration instanceof SoapServiceConfiguration) {
serviceConnector = new SOAPConnector((SoapServiceConfiguration) serviceConfiguration, alternateEndpointUrl);
} else if (serviceConfiguration instanceof RestServiceConfiguration) {
serviceConnector = new RESTConnector((RestServiceConfiguration) serviceConfiguration, alternateEndpointUrl);
}
if (serviceConnector == null) {
throw new RiceRuntimeException("Don't support service type of " + serviceConfiguration);
}
serviceConnector.setCredentialsSource(credentialsSource);
return serviceConnector;
}
示例8: setCredentialsSource
import org.kuali.rice.core.api.security.credentials.CredentialsSource; //导入依赖的package包/类
/**
* Method to set the optional CredentialsSource. A ServiceConnector is free
* to use the CredentialsSource to provide credentials to a remote service.
*/
void setCredentialsSource(CredentialsSource credentialsSource);