Esempio n. 1
0
 /**
  * Constructor.
  *
  * <p>
  *
  * @see OAuthService#createProcess(String scope)
  */
 protected OAuthProcess(OAuthService service, String scope) {
   super();
   this.service_ = service;
   this.scope_ = scope;
   this.authenticate_ = false;
   this.authorized_ = new Signal1<OAuthAccessToken>(this);
   this.authenticated_ = new Signal1<Identity>(this);
   this.redirected_ = new JSignal(this, "redirected");
   this.oAuthState_ = "";
   this.token_ = new OAuthAccessToken();
   this.error_ = new WString();
   this.startInternalPath_ = "";
   this.redirectEndpoint_ = new OAuthRedirectEndpoint(this);
   WApplication app = WApplication.getInstance();
   PopupWindow.loadJavaScript(app);
   String url = app.makeAbsoluteUrl(this.redirectEndpoint_.getUrl());
   this.oAuthState_ = this.service_.encodeState(url);
   this.redirected_.addListener(
       this,
       new Signal.Listener() {
         public void trigger() {
           OAuthProcess.this.onOAuthDone();
         }
       });
   if (!app.getEnvironment().hasJavaScript()) {
     app.internalPathChanged()
         .addListener(
             this,
             new Signal1.Listener<String>() {
               public void trigger(String e1) {
                 OAuthProcess.this.handleRedirectPath(e1);
               }
             });
   }
 }