예제 #1
0
파일: Utils.java 프로젝트: papperwing/perun
  /**
   * Return URL to identity consolidator GUI with optional ?target= param having current Perun GUI
   * URL.
   *
   * @param target TRUE if use ?target= param in identity consolidator URL / FALSE otherwise
   * @return URL to identity consolidator
   */
  public static String getIdentityConsolidatorLink(boolean target) {

    // always use URL of machine, where GUI runs
    String baseUrl = Window.Location.getProtocol() + "//" + Window.Location.getHost();

    // FIXME - production consolidator is still using old URL scheme
    final String URL_KRB = baseUrl + "/perun-identity-consolidator-krb/";
    final String URL_FED = baseUrl + "/perun-identity-consolidator-fed/";
    final String URL_CERT = baseUrl + "/perun-identity-consolidator-cert/";
    String rpc = "";
    String link = "";

    if (PerunWebSession.getInstance().getRpcServer() != null) {
      rpc = PerunWebSession.getInstance().getRpcServer();
    }

    if (rpc.equalsIgnoreCase("krb")) {
      link = URL_KRB;
    } else if (rpc.equalsIgnoreCase("fed")) {
      link = URL_FED;
    } else if (rpc.equalsIgnoreCase("cert")) {
      link = URL_CERT;
    } else {
      // KRB AS BACKUP - "default"
      link = URL_KRB;
    }

    if (target) {
      link += "?target=" + Window.Location.getHref();
    }

    return link;
  }
예제 #2
0
 public void createDeepLink() {
   if (tabContent instanceof IFrameTabPanel) {
     PromptDialogBox dialogBox =
         new PromptDialogBox(
             Messages.getString("deepLink"),
             Messages.getString("ok"),
             Messages.getString("cancel"),
             false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             true);
     String url =
         Window.Location.getProtocol()
             + "//"
             + Window.Location.getHostName()
             + ":"
             + Window.Location.getPort()
             + Window.Location.getPath() // $NON-NLS-1$ //$NON-NLS-2$
             + "?name="
             + textLabel.getText()
             + "&startup-url="; //$NON-NLS-1$ //$NON-NLS-2$
     String startup = ((IFrameTabPanel) tabContent).getUrl();
     TextBox urlbox = new TextBox();
     urlbox.setText(url + URL.encodeComponent(startup));
     urlbox.setVisibleLength(80);
     dialogBox.setContent(urlbox);
     dialogBox.center();
   }
 }
예제 #3
0
  @Override
  protected void onBind() {
    super.onBind();

    redirect =
        Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/oauthcallback.html";

    // Get the login url for Google
    _requestCache.getGoogleUrl(
        redirect,
        new AsyncCallback<String>() {
          @Override
          public void onSuccess(final String url) {
            getView().setGoogleLoginUrl(url);
          }

          @Override
          public void onFailure(final Throwable caught) {}
        });

    // Get the login url for Facebook
    _requestCache.getFacebookUrl(
        redirect,
        new AsyncCallback<String>() {
          @Override
          public void onSuccess(final String url) {
            getView().setFacebookLoginUrl(url);
          }

          @Override
          public void onFailure(final Throwable caught) {}
        });
  }
예제 #4
0
파일: Utils.java 프로젝트: papperwing/perun
  /**
   * Return URL to Password change GUI for selected namespace
   *
   * @param namespace namespace where we want to reset password
   * @return URL to password reset GUI
   */
  public static String getPasswordResetLink(String namespace) {

    String value =
        PerunWebSession.getInstance().getConfiguration().getCustomProperty("getPasswordResetUrl");

    if (value != null && !value.isEmpty()) {

      // PWD-RESET URL IS CONFIGURED AS FIXED
      if (namespace != null && !namespace.isEmpty()) {
        return value + "?login-namespace=" + namespace;
      } else {
        return value;
      }

    } else {

      // USE RELATIVE PWD-RESET URL

      String baseUrl = Window.Location.getProtocol() + "//" + Window.Location.getHost();

      if (!Utils.isDevel()) {

        // VALID URL FOR PRODUCTION

        String rpc = "";
        if (PerunWebSession.getInstance().getRpcServer() != null) {
          rpc = PerunWebSession.getInstance().getRpcServer();
        }

        if (rpc.equalsIgnoreCase("krb")) {
          baseUrl += "/krb";
        } else if (rpc.equalsIgnoreCase("fed")) {
          baseUrl += "/fed";
        } else if (rpc.equalsIgnoreCase("forceAuthn-fed")) {
          baseUrl += "/fed-force";
        } else if (rpc.equalsIgnoreCase("cert")) {
          baseUrl += "/cert";
        } else if (rpc.equalsIgnoreCase("einfra")) {
          baseUrl += "/krb-einfra";
        } else {
          // KRB AS BACKUP - "default"
          baseUrl += "/krb";
        }

        baseUrl += "/pwd-reset/";

      } else {

        // VALID URL FOR DEVEL
        baseUrl += "/PasswordResetKrb.html";
      }

      if (namespace != null && !namespace.isEmpty()) {
        return baseUrl + "?login-namespace=" + namespace;
      } else {
        return baseUrl;
      }
    }
  }
 private void showPopUp() {
   String authUrl =
       baseUrl
           + "/oauth/authenticate?oauth_provider=github"
           + "&scope=user,repo,write:public_key&userId="
           + userId
           + "&redirect_after_login="******"//"
           + Window.Location.getHost()
           + "/ws/"
           + Config.getWorkspaceName();
   JsOAuthWindow authWindow = new JsOAuthWindow(authUrl, "error.url", 500, 980, this);
   authWindow.loginWithOAuth();
 }
 /** Costructor */
 public CollectionSummaryTeacherView() {
   this.res = CollectionSummaryTeacherCBundle.INSTANCE;
   res.css().ensureInjected();
   setWidget(uiBinder.createAndBindUi(this));
   String urlDomain = Window.Location.getProtocol() + "//" + Window.Location.getHost();
   style =
       "<link rel='styleSheet' type='text/css' href='"
           + urlDomain
           + "/css/googleVisualization.css'><link href='"
           + urlDomain
           + "/css/printAnalytics.css' rel='stylesheet' type='text/css'>";
   setData();
   printWidget.setVisible(false);
   downloadFile.setVisible(false);
 }
 @Override
 public void onLoad() {
   if (collectionItemDo
       .getResource()
       .getResourceType()
       .getName()
       .equalsIgnoreCase("assessment-question")) {
     resourceThumbnail.setUrl(getQuestionImage());
   } else if (collectionItemDo
       .getResource()
       .getResourceType()
       .getName()
       .equalsIgnoreCase("video/youtube")) {
     resourceThumbnail.setUrl(
         ResourceImageUtil.youtubeImageLink(
             ResourceImageUtil.getYoutubeVideoId(collectionItemDo.getResource().getUrl()),
             Window.Location.getProtocol()));
   } else {
     resourceThumbnail.setUrl(collectionItemDo.getResource().getThumbnails().getUrl());
   }
 }