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


Java AuthorizationCodeRequestUrl.setState方法代码示例

本文整理汇总了Java中com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setState方法的典型用法代码示例。如果您正苦于以下问题:Java AuthorizationCodeRequestUrl.setState方法的具体用法?Java AuthorizationCodeRequestUrl.setState怎么用?Java AuthorizationCodeRequestUrl.setState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl的用法示例。


在下文中一共展示了AuthorizationCodeRequestUrl.setState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: authorizationRequestUri

import com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl; //导入方法依赖的package包/类
/**
 * Generates the authorization request URI for the client credentials.
 * @param redirectionEndpoint redirection endpoint for the authorization
 * and token requests; if this value is <code>null</code>, the
 * <code>redirect_uri</code> parameter shall not be included.
 * @param state opaque state string for the authorization request; if this
 * argument is <code>null</code>, the <code>state</code> parameter shall
 * not be used
 * @return authorization request URI
 * @throws NullPointerException if this object had no client credentials
 * @since 5.0
 */
public String authorizationRequestUri(
        URI redirectionEndpoint, String state) {
    redirectionEndpointUri = null;
    if (redirectionEndpoint != null) {
        redirectionEndpointUri = redirectionEndpoint.toString();
    }

    AuthorizationCodeFlow flow = getAuthorizationCodeFlow(false);
    AuthorizationCodeRequestUrl request = flow.newAuthorizationUrl();
    if (redirectionEndpointUri != null) {
        request.setRedirectUri(redirectionEndpointUri);
    }
    if (state != null) {
        request.setState(state);
    }
    return request.build();
}
 
开发者ID:kazssym,项目名称:bitbucket-api-client-java,代码行数:30,代码来源:OAuthClient.java

示例2: getAuthenticateUrl

import com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl; //导入方法依赖的package包/类
/**
 * Create authentication URL.
 *
 * @param requestUrl URL of current HTTP request. This parameter required to be able determine URL
 *     for redirection after authentication. If URL contains query parameters they will be copy to
 *     'state' parameter and returned to callback method.
 * @param scopes specify exactly what type of access needed
 * @return URL for authentication
 */
public String getAuthenticateUrl(URL requestUrl, List<String> scopes)
    throws OAuthAuthenticationException {
  if (!isConfigured()) {
    throw new OAuthAuthenticationException("Authenticator is not configured");
  }

  AuthorizationCodeRequestUrl url =
      flow.newAuthorizationUrl().setRedirectUri(findRedirectUrl(requestUrl)).setScopes(scopes);
  url.setState(prepareState(requestUrl));
  return url.build();
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:OAuthAuthenticator.java

示例3: onAuthorization

import com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl; //导入方法依赖的package包/类
@Override
protected void onAuthorization(HttpServletRequest req,
		HttpServletResponse resp,
		AuthorizationCodeRequestUrl authorizationUrl)
		throws ServletException, IOException {
	authorizationUrl.setState(req.getParameter("state"));
	super.onAuthorization(req, resp, authorizationUrl);
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:9,代码来源:DriveUIAuthorizationServlet.java


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