本文整理匯總了Java中org.jets3t.service.security.ProviderCredentials類的典型用法代碼示例。如果您正苦於以下問題:Java ProviderCredentials類的具體用法?Java ProviderCredentials怎麽用?Java ProviderCredentials使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ProviderCredentials類屬於org.jets3t.service.security包,在下文中一共展示了ProviderCredentials類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: RestS3Service
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
/**
* Constructs the service and initialises the properties.
*
* @param credentials
* the S3 user credentials to use when communicating with S3, may be null in which case the
* communication is done as an anonymous user.
* @param invokingApplicationDescription
* a short description of the application using the service, suitable for inclusion in a
* user agent string for REST/HTTP requests. Ideally this would include the application's
* version number, for example: <code>Cockpit/0.7.3</code> or <code>My App Name/1.0</code>
* @param credentialsProvider
* an implementation of the HttpClient CredentialsProvider interface, to provide a means for
* prompting for credentials when necessary.
* @param jets3tProperties
* JetS3t properties that will be applied within this service.
*
* @throws S3ServiceException
*/
public RestS3Service(ProviderCredentials credentials, String invokingApplicationDescription,
CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties)
throws S3ServiceException
{
super(credentials, invokingApplicationDescription, credentialsProvider, jets3tProperties);
if (credentials instanceof AWSDevPayCredentials) {
AWSDevPayCredentials awsDevPayCredentials = (AWSDevPayCredentials) credentials;
this.awsDevPayUserToken = awsDevPayCredentials.getUserToken();
this.awsDevPayProductToken = awsDevPayCredentials.getProductToken();
} else {
this.awsDevPayUserToken = jets3tProperties.getStringProperty("devpay.user-token", null);
this.awsDevPayProductToken = jets3tProperties.getStringProperty("devpay.product-token", null);
}
this.setRequesterPaysEnabled(
this.jets3tProperties.getBoolProperty("httpclient.requester-pays-buckets-enabled", false));
}
示例2: getCredentials
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
@Override
protected ProviderCredentials getCredentials() {
//I've made the credentials a singleton object because otherwise
//JUnit tries to get a bunch of access tokens, which I suspect is being
//flagged as a DoS attempt, and hence starts failing after the first
//few token fetches.
synchronized(getClass()) {
if(savedCredentials == null) {
savedCredentials = new OAuth2Credentials(
testProperties.getProperty("gsservice.client_id"),
testProperties.getProperty("gsservice.client_secret"),
null,
testProperties.getProperty("gsservice.refresh_token"));
}
}
return savedCredentials;
}
示例3: getRestS3Service
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
protected RestS3Service getRestS3Service(ProviderCredentials credentials)
throws S3ServiceException
{
if (!this.isTargetS3) {
// Override endpoint property in JetS3t properties
originalTargetEndpoint = cockpitProperties.getStringProperty(
"s3service.s3-endpoint", Constants.S3_DEFAULT_HOSTNAME);
cockpitProperties.setProperty(
"s3service.s3-endpoint", Constants.GS_DEFAULT_HOSTNAME);
} else if (originalTargetEndpoint != null) {
cockpitProperties.setProperty(
"s3service.s3-endpoint", originalTargetEndpoint);
}
return new RestS3Service(credentials, APPLICATION_DESCRIPTION,
this, cockpitProperties);
}
示例4: refreshStoredCredentialsTable
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
/**
* Refreshes the table of stored credentials by finding <tt>*.enc</tt> files in the
* directory specified as the Cockpit home folder.
*
*/
public void refreshStoredCredentialsTable() {
nicknamesTableModel.removeAll();
try {
File[] files = cockpitHomeFolder.listFiles();
for (int i = 0; files != null && i < files.length; i++) {
File candidateFile = files[i];
if (candidateFile.getName().endsWith(".enc")) {
// Load partial details from credentials file.
ProviderCredentials credentials = ProviderCredentials.load(null, candidateFile);
nicknamesTableModel.addCredentialsFile(
credentials, candidateFile);
}
}
} catch (Exception e) {
String message = "Unable to find credential files in the folder "
+ cockpitHomeFolder.getAbsolutePath();
log.error(message, e);
ErrorDialog.showDialog(ownerFrame, hyperlinkListener, message, e);
}
}
示例5: addCredentialsFile
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
public int addCredentialsFile(ProviderCredentials credentials, File credentialsFile) {
int insertRow =
Collections.binarySearch(credentialsList, credentials, new Comparator() {
public int compare(Object o1, Object o2) {
String name1 = ((ProviderCredentials)o1).getFriendlyName();
String name2 = ((ProviderCredentials)o2).getFriendlyName();
int result = name1.compareToIgnoreCase(name2);
return result;
}
});
if (insertRow >= 0) {
// We already have an item with this key, replace it.
credentialsList.remove(insertRow);
credentialFileList.remove(insertRow);
this.removeRow(insertRow);
} else {
insertRow = (-insertRow) - 1;
}
// New object to insert.
credentialsList.add(insertRow, credentials);
credentialFileList.add(insertRow, credentialsFile);
this.insertRow(insertRow, new Object[] {credentials.getFriendlyName()});
return insertRow;
}
示例6: main
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
/**
* Creates stand-alone dialog box for testing only.
*
* @param args
* @throws Exception
*/
public static void main(String args[]) throws Exception {
JFrame f = new JFrame();
HyperlinkActivatedListener listener = new HyperlinkActivatedListener() {
private static final long serialVersionUID = -225585129296632961L;
public void followHyperlink(URL url, String target) {
BareBonesBrowserLaunch.openURL(url.toString());
}
};
StartupDialog startupDialog = new StartupDialog(f,
Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME), listener);
startupDialog.setVisible(true);
ProviderCredentials credentials = startupDialog.getProviderCredentials();
startupDialog.dispose();
if (credentials != null) {
System.out.println("Credentials: " + credentials.getLogString());
} else {
System.out.println("Credentials: null");
}
f.dispose();
}
示例7: StorageService
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
/**
* Construct a <code>StorageService</code> identified by the given user credentials.
*
* @param credentials
* the user credentials, may be null in which case the communication is done as an anonymous user.
* @param invokingApplicationDescription
* a short description of the application using the service, suitable for inclusion in a
* user agent string for REST/HTTP requests. Ideally this would include the application's
* version number, for example: <code>Cockpit/0.7.3</code> or <code>My App Name/1.0</code>
* @param jets3tProperties
* JetS3t properties that will be applied within this service.
*/
protected StorageService(ProviderCredentials credentials, String invokingApplicationDescription,
Jets3tProperties jets3tProperties)
{
this.credentials = credentials;
this.invokingApplicationDescription = invokingApplicationDescription;
this.jets3tProperties = jets3tProperties;
this.isHttpsOnly = this.getHttpsOnly();
this.internalErrorRetryMax = jets3tProperties.getIntProperty(
"storage-service.internal-error-retry-max", 5);
this.initializeDefaults();
}
示例8: getProviderCredentials
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
/**
* @return the credentials identifying the service user, or null for anonymous.
*/
public ProviderCredentials getProviderCredentials() {
return credentials.refreshAndGetCredentials() ;
}
示例9: getStorageService
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
protected RestStorageService getStorageService(ProviderCredentials credentials,
String endpointHostname) throws ServiceException
{
Jets3tProperties properties = new Jets3tProperties();
properties.setProperty("s3service.s3-endpoint", endpointHostname);
return getStorageService(credentials, properties);
}
示例10: retrieveCredentialsFromDirectory
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
private void retrieveCredentialsFromDirectory(File directory, File credentialsFile, String password) {
if (!validFolderInputs(false, directory, credentialsFile, password, true)) {
return;
}
try {
this.credentials = ProviderCredentials.load(password, credentialsFile);
this.setVisible(false);
} catch (Exception e) {
String message = "<html><center>Unable to load your credentials from the file: "
+ credentialsFile + "<br><br>Please check your password</center></html>";
log.error(message, e);
ErrorDialog.showDialog(this, hyperlinkListener, message, null);
}
}
示例11: authorize
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
protected boolean authorize(HttpUriRequest httpMethod, ProviderCredentials credentials)
throws ServiceException {
return false;
}
示例12: authorize
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
@Override
protected boolean authorize(final HttpUriRequest request, final ProviderCredentials credentials) throws ServiceException {
request.setHeader("x-goog-api-version", "2");
return true;
}
示例13: S3Service
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
protected S3Service(ProviderCredentials credentials, String invokingApplicationDescription,
CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties)
{
super(credentials, invokingApplicationDescription, credentialsProvider,
jets3tProperties);
}
示例14: getAWSCredentials
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
/**
* @return the credentials identifying the service user, or null for anonymous.
* @deprecated 0.8.0 use {@link #getProviderCredentials()} instead
*/
@Deprecated
public ProviderCredentials getAWSCredentials() {
return credentials;
}
示例15: getAWSCredentials
import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
/**
* @return the Storage Provider Credentials identifying the AWS user.
*/
public ProviderCredentials getAWSCredentials() {
return credentials;
}