Пример #1
0
 /**
  * Starts an authorization process.
  *
  * <p>This starts an authorization process to request an accesstoken to access protected
  * information within the process scope.
  *
  * <p>The authorization process ends with the {@link OAuthProcess#authorized() authorized()}
  * signal which signals the obtained token.
  *
  * <p>
  *
  * <p><i><b>Note: </b>To be able to use a popup (instead of a page redirect), you should connect
  * this method directly to an, since popup windows are blocked in most web browsers unless they
  * are the direct consequence of an event. </i>
  */
 public void startAuthorize() {
   WApplication app = WApplication.getInstance();
   if (!app.getEnvironment().hasJavaScript()) {
     this.startInternalPath_ = app.getInternalPath();
     app.redirect(this.getAuthorizeUrl());
   } else {
     this.redirectEndpoint_.getUrl();
   }
 }
Пример #2
0
 private void handleToken(Exception err, HttpMessage response) {
   if (err == null) {
     this.doParseTokenResponse(response);
   } else {
     logger.error(
         new StringWriter().append("handleToken(): ").append(err.getMessage()).toString());
     this.setError(new WString(err.getMessage()));
   }
   WApplication app = WApplication.getInstance();
   if (app.getEnvironment().hasAjax()) {
   } else {
     this.onOAuthDone();
     app.redirect(app.url(this.startInternalPath_));
   }
 }