List of usage examples for com.google.api.client.googleapis.auth.oauth2 GoogleAuthorizationCodeRequestUrl set
@Override
public GoogleAuthorizationCodeRequestUrl set(String fieldName, Object value)
From source file:ch.chnoch.appengine.bunddownloader.CredentialMediator.java
License:Apache License
/** * Retrieve the authorization URL to authorize the user with the given * email address./*ww w . j a v a2 s .co m*/ * * @param emailAddress User's e-mail address. * @return Authorization URL to redirect the user to. */ private String getAuthorizationUrl(String emailAddress) { // Generate an authorization URL based on our client settings, // the user's email address, and the state parameter, if present. GoogleAuthorizationCodeRequestUrl urlBuilder = new GoogleAuthorizationCodeRequestUrl( secrets.getWeb().getClientId(), secrets.getWeb().getRedirectUris().get(0), scopes) .setAccessType("offline").setApprovalPrompt("force"); // Propagate through the current state parameter, so that when the // user gets redirected back to our app, they see the file(s) they // were originally supposed to see before we realized we weren't // authorized. // if (request.getParameter("state") != null) { // urlBuilder.set("state", request.getParameter("state")); // } if (emailAddress != null) { urlBuilder.set("user_id", emailAddress); } System.out.println(urlBuilder.build()); return urlBuilder.build(); }
From source file:com.cloudsearch.oauth.CredentialMediator.java
License:Apache License
/** * Retrieve the authorization URL to authorize the user with the given * email address./*from ww w .ja v a 2 s . c o m*/ * * @param emailAddress User's e-mail address. * @return Authorization URL to redirect the user to. */ private String getAuthorizationUrl(String emailAddress) { // Generate an authorization URL based on our client settings, // the user's email address, and the state parameter, if present. GoogleAuthorizationCodeRequestUrl urlBuilder = new GoogleAuthorizationCodeRequestUrl( secrets.getWeb().getClientId(), secrets.getWeb().getRedirectUris().get(0), scopes) .setAccessType("offline").setApprovalPrompt("force"); // Propagate through the current state parameter, so that when the // user gets redirected back to our app, they see the file(s) they // were originally supposed to see before we realized we weren't // authorized. if (request.getState() != null) { urlBuilder.set("state", request.getState()); } if (emailAddress != null) { urlBuilder.set("user_id", emailAddress); } return urlBuilder.build(); }
From source file:com.google.drive.samples.dredit.CredentialMediator.java
License:Apache License
/** * Retrieve the authorization URL to authorize the user with the given * email address.//w w w . ja v a 2 s . co m * * @param emailAddress User's e-mail address. * @return Authorization URL to redirect the user to. */ private String getAuthorizationUrl(String emailAddress) { // Generate an authorization URL based on our client settings, // the user's email address, and the state parameter, if present. GoogleAuthorizationCodeRequestUrl urlBuilder = new GoogleAuthorizationCodeRequestUrl( secrets.getWeb().getClientId(), secrets.getWeb().getRedirectUris().get(0), scopes) .setAccessType("offline").setApprovalPrompt("force"); // Propagate through the current state parameter, so that when the // user gets redirected back to our app, they see the file(s) they // were originally supposed to see before we realized we weren't // authorized. if (request.getParameter("state") != null) { urlBuilder.set("state", request.getParameter("state")); } if (emailAddress != null) { urlBuilder.set("user_id", emailAddress); } return urlBuilder.build(); }
From source file:com.mxgraph.online.dredit.FileServlet.java
License:Apache License
/** * Retrieve the authorization URL to authorize the user with the given * email address.// w w w. j a v a2 s. c o m * * @param emailAddress User's e-mail address. * @return Authorization URL to redirect the user to. */ public String getAuthorizationUrl(HttpServletRequest request, boolean ignoreState) { // Generate an authorization URL based on our client settings, // the user's email address, and the state parameter, if present. updateSecrets(); GoogleAuthorizationCodeRequestUrl urlBuilder = new GoogleAuthorizationCodeRequestUrl( secrets.getWeb().getClientId(), secrets.getWeb().getRedirectUris().get(0), SCOPES) .setAccessType("offline").setApprovalPrompt("force"); // Propagate through the current state parameter, so that when the // user gets redirected back to our app, they see the file(s) they // were originally supposed to see before we realized we weren't // authorized. if (!ignoreState && request.getParameter("state") != null) { urlBuilder.set("state", request.getParameter("state")); } if (request.getSession() != null) { String emailAddress = (String) request.getSession().getAttribute(CredentialMediator.EMAIL_KEY); if (emailAddress != null) { urlBuilder.set("user_id", emailAddress); } } return urlBuilder.build(); }
From source file:it.micheleorsi.drive.samples.dredit.CredentialMediator.java
License:Apache License
/** * Retrieve the authorization URL to authorize the user with the given * email address./*from w w w. j a v a 2 s .co m*/ * * @param emailAddress User's e-mail address. * @return Authorization URL to redirect the user to. */ private String getAuthorizationUrl(String emailAddress) { GoogleAuthorizationCodeRequestUrl urlBuilder = new GoogleAuthorizationCodeRequestUrl( secrets.getWeb().getClientId(), secrets.getWeb().getRedirectUris().get(0), scopes) .setAccessType("offline").setApprovalPrompt("force"); if (request.getParameter("state") != null) { urlBuilder.set("state", request.getParameter("state")); } if (emailAddress != null) { urlBuilder.set("user_id", emailAddress); } return urlBuilder.build(); }
From source file:uk.ac.cam.cl.dtg.segue.auth.GoogleAuthenticator.java
License:Apache License
@Override public String getAuthorizationUrl(final String antiForgeryStateToken) throws IOException { GoogleAuthorizationCodeRequestUrl urlBuilder = null; urlBuilder = new GoogleAuthorizationCodeRequestUrl(clientSecrets.getDetails().getClientId(), callbackUri, requestedScopes);// w w w . ja va 2s.c om // .setAccessType("online") // these can be used to force approval each // time the user logs in if we wish. // .setApprovalPrompt("force"); urlBuilder.set(Constants.STATE_PARAM_NAME, antiForgeryStateToken); return urlBuilder.build(); }