use of org.eclipse.che.security.oauth1.OAuthAuthenticationException in project che-server by eclipse-che.
the class HttpBitbucketServerApiClientTest method start.
@BeforeMethod
void start() {
wireMockServer = new WireMockServer(wireMockConfig().notifier(new Slf4jNotifier(false)).dynamicPort());
wireMockServer.start();
WireMock.configureFor("localhost", wireMockServer.port());
wireMock = new WireMock("localhost", wireMockServer.port());
bitbucketServer = new HttpBitbucketServerApiClient(wireMockServer.url("/"), new BitbucketServerOAuthAuthenticator("", "", "", "") {
@Override
public String computeAuthorizationHeader(String userId, String requestMethod, String requestUrl) throws OAuthAuthenticationException {
return AUTHORIZATION_TOKEN;
}
});
}
use of org.eclipse.che.security.oauth1.OAuthAuthenticationException in project devspaces-images by redhat-developer.
the class HttpBitbucketServerApiClientTest method start.
@BeforeMethod
void start() {
wireMockServer = new WireMockServer(wireMockConfig().notifier(new Slf4jNotifier(false)).dynamicPort());
wireMockServer.start();
WireMock.configureFor("localhost", wireMockServer.port());
wireMock = new WireMock("localhost", wireMockServer.port());
bitbucketServer = new HttpBitbucketServerApiClient(wireMockServer.url("/"), new BitbucketServerOAuthAuthenticator("", "", "", "") {
@Override
public String computeAuthorizationHeader(String userId, String requestMethod, String requestUrl) throws OAuthAuthenticationException {
return AUTHORIZATION_TOKEN;
}
});
}
use of org.eclipse.che.security.oauth1.OAuthAuthenticationException in project che-server by eclipse-che.
the class HttpBitbucketServerApiClient method computeAuthorizationHeader.
private String computeAuthorizationHeader(String requestMethod, String requestUrl) throws ScmUnauthorizedException, ScmCommunicationException {
try {
Subject subject = EnvironmentContext.getCurrent().getSubject();
String authorizationHeader = authenticator.computeAuthorizationHeader(subject.getUserId(), requestMethod, requestUrl);
if (Strings.isNullOrEmpty(authorizationHeader)) {
throw buildScmUnauthorizedException();
}
return authorizationHeader;
} catch (OAuthAuthenticationException e) {
throw new ScmCommunicationException(e.getMessage(), e);
}
}
use of org.eclipse.che.security.oauth1.OAuthAuthenticationException in project devspaces-images by redhat-developer.
the class HttpBitbucketServerApiClient method computeAuthorizationHeader.
private String computeAuthorizationHeader(String requestMethod, String requestUrl) throws ScmUnauthorizedException, ScmCommunicationException {
try {
Subject subject = EnvironmentContext.getCurrent().getSubject();
String authorizationHeader = authenticator.computeAuthorizationHeader(subject.getUserId(), requestMethod, requestUrl);
if (Strings.isNullOrEmpty(authorizationHeader)) {
throw buildScmUnauthorizedException();
}
return authorizationHeader;
} catch (OAuthAuthenticationException e) {
throw new ScmCommunicationException(e.getMessage(), e);
}
}
Aggregations