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


Java HostUser类代码示例

本文整理汇总了Java中org.eclipse.che.plugin.pullrequest.shared.dto.HostUser的典型用法代码示例。如果您正苦于以下问题:Java HostUser类的具体用法?Java HostUser怎么用?Java HostUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HostUser类属于org.eclipse.che.plugin.pullrequest.shared.dto包,在下文中一共展示了HostUser类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: authenticate

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
@Override
public Promise<HostUser> authenticate(final CurrentUser user) {
  final Workspace workspace = this.appContext.getWorkspace();
  if (workspace == null) {
    return reject(JsPromiseError.create("Error accessing current workspace"));
  }
  String oauthPath =
      "https://bitbucket.org".equals(bitbucketEndpoint)
          ? "/oauth/authenticate?oauth_provider=bitbucket&userId="
          : "/oauth/1.0/authenticate?oauth_provider=bitbucket-server&request_method=post&signature_method=rsa&userId=";

  final String authUrl =
      baseUrl
          + oauthPath
          + user.getProfile().getUserId()
          + "&redirect_after_login="
          + Window.Location.getProtocol()
          + "//"
          + Window.Location.getHost()
          + "/ws/"
          + workspace.getConfig().getName();
  return ServiceUtil.performWindowAuth(this, authUrl, securityTokenProvider);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:24,代码来源:BitbucketHostingService.java

示例2: getUserInfo

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
@Override
public Promise<HostUser> getUserInfo() {
  return microsoftClient
      .getUserProfile()
      .then(
          new Function<MicrosoftUserProfile, HostUser>() {
            @Override
            public HostUser apply(MicrosoftUserProfile microsoftUserProfile)
                throws FunctionException {
              return dtoFactory
                  .createDto(HostUser.class)
                  .withId(microsoftUserProfile.getId())
                  .withLogin(microsoftUserProfile.getEmailAddress())
                  .withName(microsoftUserProfile.getDisplayName())
                  .withUrl("none");
            }
          });
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:19,代码来源:MicrosoftHostingService.java

示例3: authenticate

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
@Override
public Promise<HostUser> authenticate(CurrentUser user) {
  final Workspace workspace = this.appContext.getWorkspace();
  if (workspace == null) {
    return Promises.reject(JsPromiseError.create("Error accessing current workspace"));
  }
  final String authUrl =
      baseUrl
          + "/oauth/authenticate?oauth_provider=microsoft&userId="
          + user.getProfile().getUserId()
          + "&scope=vso.code_manage%20vso.code_status&redirect_after_login="
          + Window.Location.getProtocol()
          + "//"
          + Window.Location.getHost()
          + "/ws/"
          + workspace.getConfig().getName();
  return ServiceUtil.performWindowAuth(this, authUrl, securityTokenProvider);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:19,代码来源:MicrosoftHostingService.java

示例4: getUserInfo

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
@Override
public Promise<HostUser> getUserInfo() {
  return oAuthServiceClient
      .getToken(SERVICE_NAME.toLowerCase())
      .thenPromise(token -> gitHubClientService.getUserInfo(token.getToken()))
      .then(
          new Function<GitHubUser, HostUser>() {
            @Override
            public HostUser apply(GitHubUser gitHubUser) throws FunctionException {
              return dtoFactory
                  .createDto(HostUser.class)
                  .withId(gitHubUser.getId())
                  .withLogin(gitHubUser.getLogin())
                  .withName(gitHubUser.getName())
                  .withUrl(gitHubUser.getUrl());
            }
          });
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:GitHubHostingService.java

示例5: authenticate

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
@Override
public Promise<HostUser> authenticate(final CurrentUser user) {
  final Workspace workspace = this.appContext.getWorkspace();
  if (workspace == null) {
    return Promises.reject(JsPromiseError.create("Error accessing current workspace"));
  }
  final String authUrl =
      baseUrl
          + "/oauth/authenticate?oauth_provider=github&userId="
          + user.getId()
          + "&scope=user,repo,write:public_key&redirect_after_login="
          + Window.Location.getProtocol()
          + "//"
          + Window.Location.getHost()
          + "/ws/"
          + workspace.getConfig().getName();
  return ServiceUtil.performWindowAuth(this, authUrl, securityTokenProvider);
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:GitHubHostingService.java

示例6: getUserInfo

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
@Override
public Promise<HostUser> getUserInfo() {
  return bitbucketClientService
      .getUser()
      .then(
          (Function<BitbucketUser, HostUser>)
              user ->
                  dtoFactory
                      .createDto(HostUser.class)
                      .withId(user.getUuid())
                      .withName(user.getDisplayName())
                      .withLogin((isHosted() ? "" : "~") + user.getUsername())
                      .withUrl(user.getLinks().getSelf().getHref()));
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:15,代码来源:BitbucketHostingService.java

示例7: authSuccessOp

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
private Operation<HostUser> authSuccessOp(
    final WorkflowExecutor executor, final Context context) {
  return new Operation<HostUser>() {
    @Override
    public void apply(HostUser user) throws OperationException {
      context.setHostUserLogin(user.getLogin());
      executor.done(AuthorizeCodenvyOnVCSHostStep.this, context);
    }
  };
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:AuthorizeCodenvyOnVCSHostStep.java

示例8: getUserInfo

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
/** Returns the user information on the repository host. */
Promise<HostUser> getUserInfo();
 
开发者ID:eclipse,项目名称:che,代码行数:3,代码来源:VcsHostingService.java

示例9: performWindowAuth

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
/**
 * Performs {@link JsOAuthWindow} authentication and tries to get current user.
 *
 * @param service hosting service, used to authorized user
 * @param authUrl url to perform authentication
 * @return the promise which resolves authorized user or rejects with an error
 */
public static Promise<HostUser> performWindowAuth(
    final VcsHostingService service,
    final String authUrl,
    final SecurityTokenProvider securityTokenProvider) {
  final Executor.ExecutorBody<HostUser> exBody =
      new Executor.ExecutorBody<HostUser>() {
        @Override
        public void apply(final ResolveFunction<HostUser> resolve, final RejectFunction reject) {
          new JsOAuthWindow(
                  authUrl,
                  "error.url",
                  500,
                  980,
                  new OAuthCallback() {
                    @Override
                    public void onAuthenticated(final OAuthStatus authStatus) {
                      // maybe it's possible to avoid this request if authStatus contains the vcs
                      // host user.
                      service
                          .getUserInfo()
                          .then(
                              new Operation<HostUser>() {
                                @Override
                                public void apply(HostUser user) throws OperationException {
                                  resolve.apply(user);
                                }
                              })
                          .catchError(
                              new Operation<PromiseError>() {
                                @Override
                                public void apply(PromiseError error) throws OperationException {
                                  reject.apply(error);
                                }
                              });
                    }
                  },
                  securityTokenProvider)
              .loginWithOAuth();
        }
      };
  return Promises.create(Executor.create(exBody));
}
 
开发者ID:eclipse,项目名称:che,代码行数:50,代码来源:ServiceUtil.java

示例10: authenticate

import org.eclipse.che.plugin.pullrequest.shared.dto.HostUser; //导入依赖的package包/类
/**
 * Authenticates the current user on the hosting service.
 *
 * @param user the user to authenticate
 * @return the promise which resolves host user or rejects with an error
 */
Promise<HostUser> authenticate(CurrentUser user);
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:VcsHostingService.java


注:本文中的org.eclipse.che.plugin.pullrequest.shared.dto.HostUser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。