当前位置: 首页>>代码示例>>Java>>正文


Java MemoryDataStoreFactory类代码示例

本文整理汇总了Java中com.google.api.client.util.store.MemoryDataStoreFactory的典型用法代码示例。如果您正苦于以下问题:Java MemoryDataStoreFactory类的具体用法?Java MemoryDataStoreFactory怎么用?Java MemoryDataStoreFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MemoryDataStoreFactory类属于com.google.api.client.util.store包,在下文中一共展示了MemoryDataStoreFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCredential

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
public final Credential getCredential() {
    if (googleCredential == null) {
        try {
            GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
                    secureHttpTransport,
                    JacksonFactory.getDefaultInstance(),
                    googleSecrets,
                    requiredScopes)

                    .setAccessType("offline")
                    .setDataStoreFactory(new MemoryDataStoreFactory())
                    .build();

            googleCredential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver())
                    .authorize("user");

        } catch (IOException e) {
            //Will not occur
            logger.fatal(e);
            throw new RuntimeException();
        }
    }
    return googleCredential;
}
 
开发者ID:ViniciusArnhold,项目名称:ProjectAltaria,代码行数:25,代码来源:GoogleClientServiceFactory.java

示例2: CRESTAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
public CRESTAuthenticator(String userID) {
    this.userID = userID;
    try {

        this.flow = new AuthorizationCodeFlow.Builder(
                BearerToken.authorizationHeaderAccessMethod(),
                HTTP,
                JSON,
                new GenericUrl(LOGIN_URL + "/oauth/token"),
                new ClientParametersAuthentication(CLIENT_ID, CLIENT_SECRET),
                CLIENT_ID,
                LOGIN_URL + "/oauth/authorize").
                setDataStoreFactory(MemoryDataStoreFactory.getDefaultInstance()).
                setScopes(Arrays.asList(SCOPES)).
                build();
    } catch (Exception e) {
        System.out.println(e);
    }

}
 
开发者ID:aharris1,项目名称:Dynamic-Exploration-Route-Planner,代码行数:21,代码来源:CRESTAuthenticator.java

示例3: RedHatOAuthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public RedHatOAuthAuthenticator(
    @Nullable @Named("oauth.redhat.clientid") String clientId,
    @Nullable @Named("oauth.redhat.clientsecret") String clientSecret,
    @Nullable @Named("oauth.redhat.redirecturis") String[] redirectUris,
    @Nullable @Named("oauth.redhat.authuri") String authUri,
    @Nullable @Named("oauth.redhat.tokenuri") String tokenUri,
    @Nullable @Named("oauth.redhat.useruri") String userUri)
    throws IOException {
  if (!isNullOrEmpty(clientId)
      && !isNullOrEmpty(clientSecret)
      && !isNullOrEmpty(authUri)
      && !isNullOrEmpty(tokenUri)
      && !isNullOrEmpty(userUri)
      && redirectUris != null
      && redirectUris.length != 0) {
    configure(
        clientId, clientSecret, redirectUris, authUri, tokenUri, new MemoryDataStoreFactory());
  }
  this.userUri = userUri;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:22,代码来源:RedHatOAuthAuthenticator.java

示例4: LinkedInOAuthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public LinkedInOAuthAuthenticator(
    @Nullable @Named("oauth.linkedin.clientid") String clientId,
    @Nullable @Named("oauth.linkedin.clientsecret") String clientSecret,
    @Nullable @Named("oauth.linkedin.redirecturis") String[] redirectUris,
    @Nullable @Named("oauth.linkedin.authuri") String authUri,
    @Nullable @Named("oauth.linkedin.tokenuri") String tokenUri,
    @Nullable @Named("oauth.linkedin.useruri") String userUri)
    throws IOException {
  if (!isNullOrEmpty(clientId)
      && !isNullOrEmpty(clientSecret)
      && !isNullOrEmpty(authUri)
      && !isNullOrEmpty(tokenUri)
      && !isNullOrEmpty(userUri)
      && redirectUris != null
      && redirectUris.length != 0) {
    configure(
        clientId, clientSecret, redirectUris, authUri, tokenUri, new MemoryDataStoreFactory());
  }
  this.userUri = userUri;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:22,代码来源:LinkedInOAuthAuthenticator.java

示例5: BitbucketOAuthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public BitbucketOAuthAuthenticator(
    @Nullable @Named("oauth.bitbucket.clientid") String clientId,
    @Nullable @Named("oauth.bitbucket.clientsecret") String clientSecret,
    @Nullable @Named("oauth.bitbucket.redirecturis") String[] redirectUris,
    @Nullable @Named("oauth.bitbucket.useruri") String userUri,
    @Nullable @Named("oauth.bitbucket.authuri") String authUri,
    @Nullable @Named("oauth.bitbucket.tokenuri") String tokenUri)
    throws IOException {
  super();
  if (!isNullOrEmpty(clientId)
      && !isNullOrEmpty(clientSecret)
      && !isNullOrEmpty(authUri)
      && !isNullOrEmpty(tokenUri)
      && redirectUris != null
      && redirectUris.length != 0) {

    configure(
        clientId, clientSecret, redirectUris, authUri, tokenUri, new MemoryDataStoreFactory());
  }
  this.userUri = userUri;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:23,代码来源:BitbucketOAuthAuthenticator.java

示例6: ProjectLockerOAuthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public ProjectLockerOAuthAuthenticator(
    @Nullable @Named("oauth.projectlocker.clientid") String clientId,
    @Nullable @Named("oauth.projectlocker.clientsecret") String clientSecret,
    @Nullable @Named("oauth.projectlocker.redirecturis") String[] redirectUris,
    @Nullable @Named("oauth.projectlocker.authuri") String authUri,
    @Nullable @Named("oauth.projectlocker.tokenuri") String tokenUri)
    throws IOException {
  if (!isNullOrEmpty(clientId)
      && !isNullOrEmpty(clientSecret)
      && !isNullOrEmpty(authUri)
      && !isNullOrEmpty(tokenUri)
      && redirectUris != null
      && redirectUris.length != 0) {

    configure(
        clientId, clientSecret, redirectUris, authUri, tokenUri, new MemoryDataStoreFactory());
  }
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:20,代码来源:ProjectLockerOAuthAuthenticator.java

示例7: OpenShiftGitHubOAuthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public OpenShiftGitHubOAuthAuthenticator(
    @Nullable @Named("che.oauth.github.redirecturis") String[] redirectUris,
    @Nullable @Named("che.oauth.github.authuri") String authUri,
    @Nullable @Named("che.oauth.github.tokenuri") String tokenUri)
    throws IOException {

  super("NULL", "NULL", redirectUris, authUri, tokenUri);

  if (!isNullOrEmpty(authUri)
      && !isNullOrEmpty(tokenUri)
      && redirectUris != null
      && redirectUris.length != 0) {

    configure("NULL", "NULL", redirectUris, authUri, tokenUri, new MemoryDataStoreFactory());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:OpenShiftGitHubOAuthAuthenticator.java

示例8: configure

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
/**
 * @see {@link #configure(String, String, String[], String, String, MemoryDataStoreFactory, List)}
 */
protected void configure(
    String clientId,
    String clientSecret,
    String[] redirectUris,
    String authUri,
    String tokenUri,
    MemoryDataStoreFactory dataStoreFactory)
    throws IOException {
  configure(
      clientId,
      clientSecret,
      redirectUris,
      authUri,
      tokenUri,
      dataStoreFactory,
      Collections.emptyList());
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:OAuthAuthenticator.java

示例9: GitHubOAuthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public GitHubOAuthAuthenticator(
    @Nullable @Named("che.oauth.github.clientid") String clientId,
    @Nullable @Named("che.oauth.github.clientsecret") String clientSecret,
    @Nullable @Named("che.oauth.github.redirecturis") String[] redirectUris,
    @Nullable @Named("che.oauth.github.authuri") String authUri,
    @Nullable @Named("che.oauth.github.tokenuri") String tokenUri)
    throws IOException {
  if (!isNullOrEmpty(clientId)
      && !isNullOrEmpty(clientSecret)
      && !isNullOrEmpty(authUri)
      && !isNullOrEmpty(tokenUri)
      && redirectUris != null
      && redirectUris.length != 0) {

    configure(
        clientId, clientSecret, redirectUris, authUri, tokenUri, new MemoryDataStoreFactory());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:GitHubOAuthAuthenticator.java

示例10: main

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  if (CLIENT_ID.equals("INSERT_CLIENT_ID_HERE")
      || CLIENT_SECRET.equals("INSERT_CLIENT_SECRET_HERE")) {
    throw new IllegalArgumentException("Please input your client IDs or secret. "
        + "See https://console.developers.google.com/project");
  }

  // It is highly recommended that you use a credential store in your
  // application to store a per-user Credential.
  // See: https://developers.google.com/api-client-library/java/google-api-java-client/oauth2#data_store
  DataStoreFactory storeFactory = new MemoryDataStoreFactory();

  // Authorize and store your credential.
  authorize(storeFactory, USER_ID);

  // Create a DfpSession from the credential store. You will typically do this
  // in a servlet interceptor for a web application or per separate thread
  // of your offline application.
  DfpSession dfpSession = createDfpSession(storeFactory, USER_ID);

  DfpServices dfpServices = new DfpServices();

  runExample(dfpServices, dfpSession);
}
 
开发者ID:googleads,项目名称:googleads-java-lib,代码行数:25,代码来源:AdvancedCreateCredentialFromScratch.java

示例11: WSO2OAuthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public WSO2OAuthAuthenticator(
    @Nullable @Named("oauth.wso2.clientid") String clientId,
    @Nullable @Named("oauth.wso2.clientsecret") String clientSecret,
    @Nullable @Named("oauth.wso2.redirecturis") String[] redirectUris,
    @Nullable @Named("oauth.wso2.authuri") String authUri,
    @Nullable @Named("oauth.wso2.tokenuri") String tokenUri,
    @Nullable @Named("oauth.wso2.useruri") String userUri)
    throws IOException {
  this.userUri = userUri;

  if (!isNullOrEmpty(clientId)
      && !isNullOrEmpty(clientSecret)
      && !isNullOrEmpty(authUri)
      && !isNullOrEmpty(tokenUri)
      && redirectUris != null
      && redirectUris.length != 0) {

    configure(
        clientId,
        clientSecret,
        redirectUris,
        authUri,
        tokenUri,
        new MemoryDataStoreFactory(),
        singletonList(SCOPE));
  }
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:29,代码来源:WSO2OAuthAuthenticator.java

示例12: GoogleOAuthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public GoogleOAuthAuthenticator(
    @Nullable @Named("oauth.google.clientid") String clientId,
    @Nullable @Named("oauth.google.clientsecret") String clientSecret,
    @Nullable @Named("oauth.google.redirecturis") String[] redirectUris,
    @Nullable @Named("oauth.google.authuri") String authUri,
    @Nullable @Named("oauth.google.tokenuri") String tokenUri)
    throws IOException {
  if (!isNullOrEmpty(clientId)
      && !isNullOrEmpty(clientSecret)
      && redirectUris != null
      && redirectUris.length != 0) {

    configure(
        new GoogleAuthorizationCodeFlow.Builder(
                new NetHttpTransport(),
                new JacksonFactory(),
                new GoogleClientSecrets()
                    .setWeb(
                        new GoogleClientSecrets.Details()
                            .setClientId(clientId)
                            .setClientSecret(clientSecret)
                            .setRedirectUris(Arrays.asList(redirectUris))
                            .setAuthUri(authUri)
                            .setTokenUri(tokenUri)),
                Arrays.asList(
                    "https://www.googleapis.com/auth/userinfo.email",
                    "https://www.googleapis.com/auth/userinfo.profile"))
            .setDataStoreFactory(new MemoryDataStoreFactory())
            .setApprovalPrompt("auto")
            .setAccessType("online")
            .build(),
        Arrays.asList(redirectUris));
  }
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:36,代码来源:GoogleOAuthAuthenticator.java

示例13: MicrosoftOauthAuthenticator

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
@Inject
public MicrosoftOauthAuthenticator(
    @Nullable @Named("oauth.microsoft.clientid") String clientId,
    @Nullable @Named("oauth.microsoft.clientsecret") String clientSecret,
    @Nullable @Named("oauth.microsoft.redirecturis") String[] redirectUris,
    @Nullable @Named("oauth.microsoft.authuri") String authUri,
    @Nullable @Named("oauth.microsoft.tokenuri") String tokenUri,
    @Nullable @Named("oauth.microsoft.useruri") String userUri)
    throws IOException {
  if (!isNullOrEmpty(clientId)
      && !isNullOrEmpty(clientSecret)
      && !isNullOrEmpty(authUri)
      && !isNullOrEmpty(tokenUri)
      && !isNullOrEmpty(userUri)
      && redirectUris != null
      && redirectUris.length != 0) {

    configure(
        new MicrosoftAuthorizationCodeFlow.Builder(
                BearerToken.authorizationHeaderAccessMethod(),
                new NetHttpTransport(),
                new JacksonFactory(),
                new GenericUrl(tokenUri),
                new MicrosoftParametersAuthentication(clientSecret),
                clientId,
                authUri)
            .setScopes(Arrays.asList("vso.code_manage", "vso.code_status"))
            .setDataStoreFactory(new MemoryDataStoreFactory())
            .build(),
        Arrays.asList(redirectUris));
  }

  this.userUri = userUri;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:35,代码来源:MicrosoftOauthAuthenticator.java

示例14: createOAuth2Credentials

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
/**
 * Creates an {@link OAuth2Credentials} object that can be used by any of the servlets.
 *
 * Throws an {@throws IOException} when no client ID or secret found in secrets.properties
 */
 static OAuth2Credentials createOAuth2Credentials(SessionConfiguration config) throws IOException {


    return new OAuth2Credentials.Builder()
            .setCredentialDataStoreFactory(MemoryDataStoreFactory.getDefaultInstance())
            .setRedirectUri(config.getRedirectUri())
            .setScopes(config.getScopes())
            .setClientSecrets(config.getClientId(), config.getClientSecret())
            .build();
}
 
开发者ID:uber,项目名称:rides-java-sdk,代码行数:16,代码来源:Server.java

示例15: getInMemoryDatastore

import com.google.api.client.util.store.MemoryDataStoreFactory; //导入依赖的package包/类
public DataStore<StoredCredential> getInMemoryDatastore() {
	if (inmemoryDatastore == null) {
		try {
			inmemoryDatastore = MemoryDataStoreFactory.getDefaultInstance().getDataStore("ListableMemoryCredentialStore");
		} catch (IOException e) {
			logger.error(e.getMessage(), e);
		}
	}
	return inmemoryDatastore;
}
 
开发者ID:eteration,项目名称:glassmaker,代码行数:11,代码来源:OAuth2Util.java


注:本文中的com.google.api.client.util.store.MemoryDataStoreFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。