本文整理汇总了Java中org.javaswift.joss.client.factory.AuthenticationMethod类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationMethod类的具体用法?Java AuthenticationMethod怎么用?Java AuthenticationMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationMethod类属于org.javaswift.joss.client.factory包,在下文中一共展示了AuthenticationMethod类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
public void init() {
AccountConfig config = new AccountConfig();
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(url);
if (StringUtils.isNotEmpty(tenantId)) {
config.setTenantId(tenantId);
}
if (StringUtils.isNotEmpty(tenantName)) {
config.setTenantName(tenantName);
}
Account account = new AccountFactory(config).createAccount();
this.container = account.getContainer(containerName);
}
开发者ID:jeci-sarl,项目名称:alfresco-object-storage-connectors,代码行数:17,代码来源:SwiftServiceImpl.java
示例2: createSwift
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
protected static Account createSwift(String username, String password) {
AccountConfig config = new AccountConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(swiftEndpoint);
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
return new AccountFactory(config).createAccount();
}
开发者ID:twonote,项目名称:radosgw-admin4j,代码行数:9,代码来源:BaseTest.java
示例3: getHubicAccountConfig
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
public static AccountConfig getHubicAccountConfig (final SwiftAccess sa)
{
AccountConfig accConf = new AccountConfig () ;
accConf.setDisableSslValidation(false);
accConf.setAuthenticationMethod(AuthenticationMethod.EXTERNAL);
accConf.setMock(false);
accConf.setAllowReauthenticate(true);
accConf.setAllowCaching(true) ;
accConf.setAccessProvider (getHubicAccessProvider (sa)) ;
return accConf ;
}
开发者ID:roikku,项目名称:swift-explorer,代码行数:12,代码来源:AccountConfigFactory.java
示例4: getKeystoneAccountConfig
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
public static AccountConfig getKeystoneAccountConfig ()
{
AccountConfig accConf = new AccountConfig () ;
accConf.setDisableSslValidation(false);
accConf.setAuthenticationMethod(AuthenticationMethod.KEYSTONE);
accConf.setMock(false);
accConf.setAllowReauthenticate(true);
accConf.setAllowCaching(true) ;
return accConf ;
}
开发者ID:roikku,项目名称:swift-explorer,代码行数:11,代码来源:AccountConfigFactory.java
示例5: swiftBasic
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
/**
* Create a Swift account object and connect it to Swift
*
* @param url
* The auth url (eg: localhost:8080/auth/v1.0/)
* @param username
* The username
* @param password
* The password
* @return swift Account
*/
public synchronized Account swiftBasic(String url, String username, String password, String preferredRegion) {
if (swiftUser != null) {
return swiftUser;
}
try {
AccountConfig conf = getStandardConfig(url, username, password, AuthenticationMethod.BASIC, preferredRegion);
swiftUser = createAccount(conf);
} catch (CommandException ce) {
throw new ElasticsearchException("Unable to authenticate to Swift Basic " + url + "/" + username + "/" + password, ce);
}
return swiftUser;
}
开发者ID:wikimedia,项目名称:search-repository-swift,代码行数:25,代码来源:SwiftService.java
示例6: swiftKeyStone
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
public synchronized Account swiftKeyStone(String url, String username, String password, String tenantName, String preferredRegion) {
if (swiftUser != null) {
return swiftUser;
}
try {
AccountConfig conf = getStandardConfig(url, username, password, AuthenticationMethod.KEYSTONE, preferredRegion);
conf.setTenantName(tenantName);
swiftUser = createAccount(conf);
} catch (CommandException ce) {
throw new ElasticsearchException(
"Unable to authenticate to Swift Keystone " + url + "/" + username + "/" + password + "/" + tenantName, ce);
}
return swiftUser;
}
开发者ID:wikimedia,项目名称:search-repository-swift,代码行数:16,代码来源:SwiftService.java
示例7: swiftTempAuth
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
public synchronized Account swiftTempAuth(String url, String username, String password, String preferredRegion) {
if (swiftUser != null) {
return swiftUser;
}
try {
AccountConfig conf = getStandardConfig(url, username, password, AuthenticationMethod.TEMPAUTH, preferredRegion);
swiftUser = createAccount(conf);
} catch (CommandException ce) {
throw new ElasticsearchException("Unable to authenticate to Swift Temp", ce);
}
return swiftUser;
}
开发者ID:wikimedia,项目名称:search-repository-swift,代码行数:14,代码来源:SwiftService.java
示例8: getStandardConfig
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
private AccountConfig getStandardConfig(String url, String username, String password, AuthenticationMethod method, String preferredRegion) {
AccountConfig conf = new AccountConfig();
conf.setAuthUrl(url);
conf.setUsername(username);
conf.setPassword(password);
conf.setAuthenticationMethod(method);
conf.setAllowContainerCaching(false);
conf.setAllowCaching(false);
conf.setPreferredRegion(preferredRegion);
return conf;
}
开发者ID:wikimedia,项目名称:search-repository-swift,代码行数:12,代码来源:SwiftService.java
示例9: createSwiftManager
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
/**
* swift manager (rely on joss component structure).
*
* @return the account
*/
public Account createSwiftManager() {
AccountConfig jossConfig = new AccountConfig();
jossConfig.setAuthenticationMethod(AuthenticationMethod.KEYSTONE);
jossConfig.setUsername(config.getLogin());
jossConfig.setPassword(config.getPassword());
jossConfig.setAuthUrl(RUNABOVE_KEYSTONE_URL);
jossConfig.setTenantName(config.getTenantName());
jossConfig.setTenantId(config.getTenantId());
jossConfig.setMock(config.isMocked());
return new AccountFactory(jossConfig).createAccount();
}
开发者ID:ovhlabs,项目名称:java-runabove,代码行数:18,代码来源:RunAboveBuilder.java
示例10: example
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
private static void example() {
// Create a Connection
AccountConfig config = new AccountConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(authUrl);
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
Account account = new AccountFactory(config).createAccount();
// Create a Container
Container container = account.getContainer("my-new-container");
container.create();
// Create an Object
StoredObject object = container.getObject("foo.txt");
object.uploadObject(new File("src/test/resources/foo.txt"));
// Add/Update Object Metadata
Map<String, Object> metadata = new TreeMap<String, Object>();
metadata.put("key", "value");
object.setMetadata(metadata);
// List Owned Containers
Collection<Container> containers = account.list();
for (Container currentContainer : containers) {
System.out.println(currentContainer.getName());
}
// List a Container's Content
Collection<StoredObject> objects = container.list();
for (StoredObject currentObject : objects) {
System.out.println(currentObject.getName());
}
// Retrieve an Object's Metadata
Map<String, Object> returnedMetadata = object.getMetadata();
for (String name : returnedMetadata.keySet()) {
System.out.println("META / " + name + ": " + returnedMetadata.get(name));
}
// Retrieve an Object
object.downloadObject(new File("/tmp/outfile.txt"));
// Delete an Object
object.delete();
// Delete a Container
container.delete();
}
开发者ID:twonote,项目名称:radosgw-admin4j,代码行数:50,代码来源:SwiftExample.java
示例11: setAuthenticationMethod
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
public DummyAccountFactory setAuthenticationMethod(AuthenticationMethod authenticationMethod) {
mConfig.setAuthenticationMethod(authenticationMethod);
return this;
}
开发者ID:SparkTC,项目名称:stocator,代码行数:5,代码来源:DummyAccountFactory.java
示例12: authenticate
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
@Override
public boolean authenticate(Map<String, String> parameters) {
this.parameters = parameters;
Credentials cred = new Credentials();
if (!hasValidCredentials()){
cred.removeCredentials("openstack");
return false;
}
try {
AccountConfig config = new AccountConfig();
config.setUsername(parameters.get(USER_NAME));
config.setPassword(parameters.get(PASSWORD));
config.setAuthUrl(parameters.get(AUTH_URL)); //+ "/auth/v1.0");
config.setDisableSslValidation(true);
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
Account account = new AccountFactory(config).createAccount();
this.container = account.getContainer("mainContainer");
if (!this.container.exists()) {
this.container.create();
this.container.makePublic();//TODO - Maybe this is not necessary
System.out.println("Container " + this.container.getName() + " created");
}
this.segmentContainer = account.getContainer("segments");
if (!this.segmentContainer.exists()) {
this.segmentContainer.create();
}
//Remove old credentials, if they exist
cred.removeCredentials("openstack");
//Save new credentials
String keys = parameters.get(USER_NAME) + "@" + parameters.get(PASSWORD) + "@" + parameters.get(AUTH_URL);
cred.saveCredentials("openstack", keys);
} catch (Exception ex) {
return false;
}
updateCredentials();
this.isAuthenticated = true;
return true;
}
开发者ID:modcs,项目名称:caboclo,代码行数:50,代码来源:OpenStackClient.java
示例13: getHubicAccessProvider
import org.javaswift.joss.client.factory.AuthenticationMethod; //导入依赖的package包/类
private static AuthenticationMethod.AccessProvider getHubicAccessProvider (final SwiftAccess sa)
{
return new HubicAccessProvider (sa) ;
}
开发者ID:roikku,项目名称:swift-explorer,代码行数:5,代码来源:AccountConfigFactory.java
注:本文中的org.javaswift.joss.client.factory.AuthenticationMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论