當前位置: 首頁>>代碼示例>>Java>>正文


Java ProviderCredentials類代碼示例

本文整理匯總了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));
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:37,代碼來源:RestS3Service.java

示例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;
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:18,代碼來源:TestGoogleStorageServiceOAuth.java

示例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);
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:17,代碼來源:Cockpit.java

示例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);
    }
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:26,代碼來源:LoginLocalFolderPanel.java

示例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;
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:25,代碼來源:LoginLocalFolderPanel.java

示例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();
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:32,代碼來源:StartupDialog.java

示例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();
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:26,代碼來源:StorageService.java

示例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() ;
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:7,代碼來源:StorageService.java

示例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);
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:8,代碼來源:TestRestS3Service.java

示例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);
    }
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:16,代碼來源:StartupDialog.java

示例11: authorize

import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
protected boolean authorize(HttpUriRequest httpMethod, ProviderCredentials credentials)
    throws ServiceException {
    return false;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:5,代碼來源:S3Session.java

示例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;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:6,代碼來源:GoogleStorageSession.java

示例13: S3Service

import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
protected S3Service(ProviderCredentials credentials, String invokingApplicationDescription,
    CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties)
{
    super(credentials, invokingApplicationDescription, credentialsProvider,
        jets3tProperties);
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:7,代碼來源:S3Service.java

示例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;
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:9,代碼來源:S3Service.java

示例15: getAWSCredentials

import org.jets3t.service.security.ProviderCredentials; //導入依賴的package包/類
/**
 * @return the Storage Provider Credentials identifying the AWS user.
 */
public ProviderCredentials getAWSCredentials() {
    return credentials;
}
 
開發者ID:guptavishal,項目名稱:jets3t-aws-roles,代碼行數:7,代碼來源:CloudFrontService.java


注:本文中的org.jets3t.service.security.ProviderCredentials類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。