Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1213 #1257

Merged
merged 5 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ script:
- remark -i .remark_ignore -f -u validate-links .
- remark -i .remark_ignore -u lint-no-dead-urls .
- mvn -q clean install -P checkstyle
- docker build -f repository/repository-server/Dockerfile -t eclipsevorto/vorto-repo:latest ./repository/repository-server;
- docker build -f generators/generator-runner/Dockerfile -t eclipsevorto/vorto-generators:latest ./generators/generator-runner;
- docker build --build-arg JAR_FILE=./infomodelrepository.jar -f repository/repository-server/Dockerfile -t eclipsevorto/vorto-repo:nightly ./repository/repository-server;
- docker build --build-arg JAR_FILE=./generator-runner-exec.jar -f generators/generator-runner/Dockerfile -t eclipsevorto/vorto-generators:nightly ./generators/generator-runner;
- docker push eclipsevorto/vorto-repo:nightly;
- docker push eclipsevorto/vorto-generators:nightly;
- if [ -n "$TRAVIS_TAG" ]; then
docker build --build-arg JAR_FILE=./infomodelrepository.jar -f repository/repository-server/Dockerfile -t eclipsevorto/vorto-repo:latest ./repository/repository-server;
docker build --build-arg JAR_FILE=./generator-runner-exec.jar -f generators/generator-runner/Dockerfile -t eclipsevorto/vorto-generators:latest ./generators/generator-runner;
docker build --build-arg JAR_FILE=./infomodelrepository.jar -f repository/repository-server/Dockerfile -t eclipsevorto/vorto-repo:$TRAVIS_TAG ./repository/repository-server;
docker build --build-arg JAR_FILE=./generator-runner-exec.jar -f generators/generator-runner/Dockerfile -t eclipsevorto/vorto-generators:$TRAVIS_TAG ./generators/generator-runner;
fi;

deploy:
provider: script
Expand Down
1 change: 1 addition & 0 deletions generators/generator-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
</dependencies>
</dependencyManagement>
<build>
<finalName>generator-runner</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
*/
package org.eclipse.vorto.model;

public class Dictionary implements IReferenceType {
public class DictionaryType implements IReferenceType {

private IReferenceType key;
private IReferenceType value;
private String type = "dictionary";

public Dictionary(IReferenceType key, IReferenceType value) {
public DictionaryType(IReferenceType key, IReferenceType value) {
this.key = key;
this.value = value;
}

protected Dictionary() {}
protected DictionaryType() {}

public IReferenceType getKey() {
return key;
Expand Down Expand Up @@ -51,7 +51,7 @@ public void setType(String type) {

@Override
public String toString() {
return "Dictionary [key=" + key + ", value=" + value + "]";
return "DictionaryType [key=" + key + ", value=" + value + "]";
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.eclipse.vorto.repository.sso;

import java.util.Arrays;

import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
Expand All @@ -31,53 +32,77 @@
import org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordAccessTokenProvider;

public class TokenUtils {
public static AccessTokenProvider proxiedAccessTokenProvider(String proxyHost, int proxyPort,
String proxyUser, String proxyPassword) {
ClientHttpRequestFactory requestFactory =
proxyAuthenticatedRequestFactory(proxyHost, proxyPort, proxyUser, proxyPassword);

AuthorizationCodeAccessTokenProvider authorizationCodeAccessTokenProvider =
new AuthorizationCodeAccessTokenProvider();
authorizationCodeAccessTokenProvider.setRequestFactory(requestFactory);

ImplicitAccessTokenProvider implicitAccessTokenProvider = new ImplicitAccessTokenProvider();
implicitAccessTokenProvider.setRequestFactory(requestFactory);

return new AccessTokenProviderChain(
Arrays.<AccessTokenProvider>asList(authorizationCodeAccessTokenProvider,
implicitAccessTokenProvider, new ResourceOwnerPasswordAccessTokenProvider(),
new ClientCredentialsAccessTokenProvider()));
}

public static AccessTokenProvider accessTokenProvider() {
AuthorizationCodeAccessTokenProvider authorizationCodeAccessTokenProvider =
new AuthorizationCodeAccessTokenProvider();

ImplicitAccessTokenProvider implicitAccessTokenProvider = new ImplicitAccessTokenProvider();

return new AccessTokenProviderChain(
Arrays.<AccessTokenProvider>asList(authorizationCodeAccessTokenProvider,
implicitAccessTokenProvider, new ResourceOwnerPasswordAccessTokenProvider(),
new ClientCredentialsAccessTokenProvider()));
}

public static ClientHttpRequestFactory proxyAuthenticatedRequestFactory(String proxyHost,
int proxyPort, String proxyUser, String proxyPassword) {
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope(proxyHost, proxyPort),
new UsernamePasswordCredentials(proxyUser, proxyPassword));
HttpClientBuilder clientBuilder = HttpClientBuilder.create();

clientBuilder.useSystemProperties();
clientBuilder.setProxy(new HttpHost(proxyHost, proxyPort));
clientBuilder.setDefaultCredentialsProvider(credsProvider);
clientBuilder.setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy());

CloseableHttpClient client = clientBuilder.build();

HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
factory.setHttpClient(client);

return factory;
}
public static AccessTokenProvider proxiedAccessTokenProvider(String proxyHost, int proxyPort,
String proxyUser, String proxyPassword) {
ClientHttpRequestFactory requestFactory =
proxyAuthenticatedRequestFactory(proxyHost, proxyPort, proxyUser, proxyPassword);
return buildAccessTokenProvider(requestFactory);
}

public static AccessTokenProvider proxiedAccessTokenProvider(String proxyHost, int proxyPort) {
ClientHttpRequestFactory requestFactory =
proxyAuthenticatedRequestFactory(proxyHost, proxyPort);
return buildAccessTokenProvider(requestFactory);
}

private static AccessTokenProvider buildAccessTokenProvider(
ClientHttpRequestFactory requestFactory) {
AuthorizationCodeAccessTokenProvider authorizationCodeAccessTokenProvider =
new AuthorizationCodeAccessTokenProvider();
authorizationCodeAccessTokenProvider.setRequestFactory(requestFactory);

ImplicitAccessTokenProvider implicitAccessTokenProvider = new ImplicitAccessTokenProvider();
implicitAccessTokenProvider.setRequestFactory(requestFactory);

return new AccessTokenProviderChain(
Arrays.<AccessTokenProvider>asList(authorizationCodeAccessTokenProvider,
implicitAccessTokenProvider, new ResourceOwnerPasswordAccessTokenProvider(),
new ClientCredentialsAccessTokenProvider()));
}

public static AccessTokenProvider accessTokenProvider() {
AuthorizationCodeAccessTokenProvider authorizationCodeAccessTokenProvider =
new AuthorizationCodeAccessTokenProvider();

ImplicitAccessTokenProvider implicitAccessTokenProvider = new ImplicitAccessTokenProvider();

return new AccessTokenProviderChain(
Arrays.<AccessTokenProvider>asList(authorizationCodeAccessTokenProvider,
implicitAccessTokenProvider, new ResourceOwnerPasswordAccessTokenProvider(),
new ClientCredentialsAccessTokenProvider()));
}

public static ClientHttpRequestFactory proxyAuthenticatedRequestFactory(String proxyHost,
int proxyPort, String proxyUser, String proxyPassword) {
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope(proxyHost, proxyPort),
new UsernamePasswordCredentials(proxyUser, proxyPassword));
return getClientBuilder(proxyHost, proxyPort, credsProvider);
}

private static ClientHttpRequestFactory proxyAuthenticatedRequestFactory(String proxyHost,
int proxyPort) {
return getClientBuilder(proxyHost, proxyPort, null);
}

private static ClientHttpRequestFactory getClientBuilder(String proxyHost, int proxyPort,
CredentialsProvider credsProvider) {
HttpClientBuilder clientBuilder = HttpClientBuilder.create();
clientBuilder.useSystemProperties();
clientBuilder.setProxy(new HttpHost(proxyHost, proxyPort));
if (credsProvider != null){
clientBuilder.setDefaultCredentialsProvider(credsProvider);
}
clientBuilder.setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy());

CloseableHttpClient client = clientBuilder.build();

HttpComponentsClientHttpRequestFactory factory =
new HttpComponentsClientHttpRequestFactory();
factory.setHttpClient(client);

return factory;
}


}
Loading