Skip to content

Commit

Permalink
updated dependencies and fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Aug 27, 2021
1 parent 032d9b5 commit 19d5c40
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 85 deletions.
28 changes: 14 additions & 14 deletions para-client/src/main/java/com/erudika/para/client/ParaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ public ParaClient(String accessKey, String secretKey) {
clientConfig.connectorProvider(new HttpUrlConnectorProvider().useSetMethodWorkaround());
SSLFactory sslFactory = null;
if (!StringUtils.isBlank(truststorePath)) {
sslFactory = SSLFactory.builder()
.withTrustMaterial(Paths.get(truststorePath), truststorePass.toCharArray())
.withProtocols(protocols).build();
}
if (!StringUtils.isBlank(keystorePath)) {
sslFactory = SSLFactory.builder()
.withIdentityMaterial(Paths.get(keystorePath), keystorePass.toCharArray())
.withTrustMaterial(Paths.get(truststorePath), truststorePass.toCharArray())
.withProtocols(protocols).build();
}
SSLContext sslContext = (sslFactory != null) ? sslFactory.getSslContext() :
SslConfigurator.newInstance().createSSLContext();
HostnameVerifier verifier = (sslFactory != null) ? sslFactory.getHostnameVerifier() :
HttpsURLConnection.getDefaultHostnameVerifier();
sslFactory = SSLFactory.builder()
.withTrustMaterial(Paths.get(truststorePath), truststorePass.toCharArray())
.withProtocols(protocols).build();
}
if (!StringUtils.isBlank(keystorePath)) {
sslFactory = SSLFactory.builder()
.withIdentityMaterial(Paths.get(keystorePath), keystorePass.toCharArray())
.withTrustMaterial(Paths.get(truststorePath), truststorePass.toCharArray())
.withProtocols(protocols).build();
}
SSLContext sslContext = (sslFactory != null) ? sslFactory.getSslContext()
: SslConfigurator.newInstance().createSSLContext();
HostnameVerifier verifier = (sslFactory != null) ? sslFactory.getHostnameVerifier()
: HttpsURLConnection.getDefaultHostnameVerifier();
apiClient = ClientBuilder.newBuilder().
sslContext(sslContext).
hostnameVerifier(verifier).
Expand Down
2 changes: 1 addition & 1 deletion para-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<name>para-core</name>

<properties>
<jacksonVer>2.12.3</jacksonVer>
<jacksonVer>2.12.4</jacksonVer>
<flexmarkVer>0.62.2</flexmarkVer>
</properties>

Expand Down
4 changes: 2 additions & 2 deletions para-jar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@
<dependency>
<groupId>com.erudika</groupId>
<artifactId>para-dao-sql</artifactId>
<version>1.40.0</version>
<version>1.40.1</version>
</dependency>
<dependency>
<groupId>com.erudika</groupId>
<artifactId>para-search-lucene</artifactId>
<version>1.39.0</version>
<version>1.39.1</version>
</dependency>
</dependencies>
</profile>
Expand Down
8 changes: 4 additions & 4 deletions para-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@
<dependency>
<groupId>com.onelogin</groupId>
<artifactId>java-saml</artifactId>
<version>2.6.0</version>
<version>2.7.0</version>
</dependency>

<!-- CAFFEINE -->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.9.1</version>
<version>2.9.2</version>
</dependency>

<!-- JERSEY -->
Expand Down Expand Up @@ -208,7 +208,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.28</version>
<version>1.29</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down Expand Up @@ -242,7 +242,7 @@
<dependency>
<groupId>com.erudika</groupId>
<artifactId>para-search-lucene</artifactId>
<version>1.34.1</version>
<version>1.39.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
45 changes: 1 addition & 44 deletions para-server/src/main/java/com/erudika/para/ParaServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,10 @@ public void preDestroy() {
destroy();
}

// @Override
// public void onStartup(ServletContext sc) throws ServletException {
// runAsWAR(sc, ParaServer.class);
// }

/**
* This is the initializing method when running ParaServer as WAR,
* deployed to a servlet container.
* @param sc the ServletContext instance
* @param app the Spring app builder instance
* @param sources the application classes that will be scanned
* @return the application context
*/
Expand All @@ -402,44 +397,6 @@ public static SpringApplicationBuilder runAsWAR(SpringApplicationBuilder app, Cl
app.sources(ErrorFilter.class, ParaServer.class);
// Ensure error pages are registered
return app.sources(sources);
// ApplicationContext parent = null;
// Object object = sc.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
// if (object instanceof ApplicationContext) {
// logger.info("Root context already created (using as parent).");
// parent = (ApplicationContext) object;
// sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, null);
// }
// SpringApplicationBuilder application = new SpringApplicationBuilder(sources);
// if (parent != null) {
// application.initializers(new ParentContextApplicationContextInitializer(parent));
// }
// application.initializers(new ServletContextApplicationContextInitializer(sc));
// application.contextFactory(ApplicationContextFactory.
// ofContextClass(AnnotationConfigServletWebServerApplicationContext.class));
//
// // entry point (WAR)
// application.profiles(Config.ENVIRONMENT);
// application.web(WebApplicationType.SERVLET);
// application.bannerMode(Banner.Mode.OFF);
// initialize(getCoreModules());
// // Ensure error pages are registered
// application.sources(ErrorFilter.class);
//
// WebApplicationContext rootAppContext = (WebApplicationContext) application.run();
//
// if (rootAppContext != null) {
// sc.addListener(new ContextLoaderListener(rootAppContext) {
// @Override
// public void contextInitialized(ServletContextEvent event) {
// // no-op because the application context is already initialized
// }
// });
// sc.getSessionCookieConfig().setName("sess");
// sc.getSessionCookieConfig().setMaxAge(1);
// sc.getSessionCookieConfig().setHttpOnly(true);
// sc.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
// }
// return rootAppContext;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private void indexAllWithRetry(String appid, Object payload) {
Para.asyncExecute(() -> {
try {
for (int i = 0; i < MAX_INDEXING_RETRIES; i++) {
Thread.sleep(1000 * (i + 1));
Thread.sleep(1000L * (i + 1));
Map<String, ParaObject> pending = Para.getDAO().readAll(appid,
new ArrayList<>(pendingIds.keySet()), true);
int pendingCount = pendingIds.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,12 @@ public UserAuthentication getOrCreateUser(App app, String accessToken, String al
if (profile != null && profile.containsKey(accountIdParam)) {
Object accid = profile.get(accountIdParam);
String oauthAccountId = accid instanceof String ? (String) accid : String.valueOf(accid);
String email = getEmail((String) profile.get(emailParam), oauthAccountId, emailDomain);
String pic = (String) profile.get(pictureParam);
String email = (String) profile.get(emailParam);
String name = (String) profile.get(nameParam);
String gname = (String) profile.get(gnParam);
String fname = (String) profile.get(fnParam);

if (StringUtils.isBlank(email)) {
if (Utils.isValidEmail(oauthAccountId)) {
email = oauthAccountId;
} else if (!StringUtils.isBlank(emailDomain)) {
email = oauthAccountId.concat("@").concat(emailDomain);
} else {
LOG.warn("Blank email attribute for OAuth2 user '{}'.", oauthAccountId);
email = oauthAccountId + "@scoold.com";
}
}

user.setAppid(getAppid(app));
user.setIdentifier(oauthPrefix(alias).concat(oauthAccountId));
user.setEmail(email);
Expand Down Expand Up @@ -461,4 +450,19 @@ private String getFullName(String gname, String fname) {
}
return gname + " " + fname;
}

private String getEmail(String e, String oauthAccountId, String emailDomain) {
String email = e;
if (StringUtils.isBlank(email)) {
if (Utils.isValidEmail(oauthAccountId)) {
email = oauthAccountId;
} else if (!StringUtils.isBlank(emailDomain)) {
email = oauthAccountId.concat("@").concat(emailDomain);
} else {
LOG.warn("Blank email attribute for OAuth2 user '{}'.", oauthAccountId);
email = oauthAccountId + "@scoold.com";
}
}
return email;
}
}
2 changes: 1 addition & 1 deletion para-server/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ spring.mvc.async.request-timeout=-1
spring.servlet.multipart.max-file-size=-1
spring.servlet.multipart.max-request-size=-1

spring.mustache.check-template-location=false
spring.mustache.check-template-location=false
4 changes: 2 additions & 2 deletions para-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<dependency>
<groupId>com.erudika</groupId>
<artifactId>para-dao-sql</artifactId>
<version>1.40.0</version>
<version>1.40.1</version>
</dependency>
<dependency>
<groupId>com.erudika</groupId>
<artifactId>para-search-lucene</artifactId>
<version>1.39.0</version>
<version>1.39.1</version>
</dependency>
<!-- PARA PLUGINS : END -->
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@
<skipITs>${skipTests}</skipITs>
<skipUTs>${skipTests}</skipUTs>
<deployPluginVer>2.8.2</deployPluginVer>
<slf4jVer>1.7.30</slf4jVer>
<logbackVer>1.2.3</logbackVer>
<awsJdkVer>2.16.46</awsJdkVer>
<slf4jVer>1.7.32</slf4jVer>
<logbackVer>1.2.5</logbackVer>
<awsJdkVer>2.17.28</awsJdkVer>
<jerseyVer>2.34</jerseyVer>
<jettyVer>9.4.42.v20210604</jettyVer>
<jettyVer>9.4.43.v20210629</jettyVer>
<springBootVer>2.5.4</springBootVer>
<metricsVer>4.1.16</metricsVer>
<commonsCodecVer>1.15</commonsCodecVer>
Expand Down

0 comments on commit 19d5c40

Please sign in to comment.