Skip to content

Commit

Permalink
Merge pull request #666 from naver/release/3.5.2
Browse files Browse the repository at this point in the history
3.5.2 RELEASE

Reviewed by : geunwoo
  • Loading branch information
songeunwoo authored Sep 29, 2020
2 parents 8f91265 + 906e012 commit 813cd0a
Show file tree
Hide file tree
Showing 56 changed files with 2,402 additions and 77 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* nGrinder 3.5.1-p1 has been released. See https://github.com/naver/ngrinder/releases
* nGrinder 3.5.2 has been released. See https://github.com/naver/ngrinder/releases

nGrinder
========
Expand Down
12 changes: 12 additions & 0 deletions RELEASE-NOTE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
3.5.2 (2020.09.29)
==================
- Changes
* Support LDAP login
- From now on you can use LDAP for user authentication.
- See [LDAP guide](https://github.com/naver/ngrinder/wiki/LDAP-Configuration)
* Support webhook
- When the specified events happen, we'll send a webhook request depends on your configuration.
- See [webhook guide](https://github.com/naver/ngrinder/wiki/Webhook)
- Trivial Fix
* Make several UI improvements.

3.5.1-p1 (2020.09.01)
==================
- Changes
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ allprojects {
apply plugin: "idea"

group = "org.ngrinder"
version = "3.5.1-p1"
version = "3.5.2"

idea {
module {
Expand Down
2 changes: 2 additions & 0 deletions ngrinder-controller/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
compile (group: "org.springframework.boot", name: "spring-boot-starter-security")
compile (group: "org.springframework.boot", name: "spring-boot-starter-data-jpa")
compile (group: "org.springframework.boot", name: "spring-boot-starter-cache")
compile (group: "org.springframework.boot", name: "spring-boot-starter-webflux")

compile (group: "com.github.jknack", name: "handlebars-springmvc", version: handlebars_version)
compile (group: "com.github.jknack", name: "handlebars-helpers", version: handlebars_version)
Expand Down Expand Up @@ -75,6 +76,7 @@ dependencies {
compile (group: "org.kohsuke", name: "github-api", version: "1.99")
compile (group: "commons-validator", name: "commons-validator", version: "1.6")
compile (group: 'org.codehaus.groovy', name: 'groovy-jsr223', version: groovy_version)
compile group: 'com.unboundid', name: 'unboundid-ldapsdk', version: '5.1.1'

compileOnly (group: "org.projectlombok", name: "lombok", version: "1.18.8")
annotationProcessor (group: "org.projectlombok", name: "lombok", version: "1.18.8")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2012-present NAVER Corp.
*
* This file is part of The nGrinder software distribution. Refer to
* the file LICENSE which is part of The nGrinder distribution for
* licensing details. The nGrinder distribution is available on the
* Internet at https://naver.github.io/ngrinder
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ngrinder.common.constant;

public interface LdapConstants {
String PROP_LDAP_ENABLED = "ldap.enabled";
String PROP_LDAP_SERVER = "ldap.server";
String PROP_LDAP_PORT = "ldap.port";
String PROP_LDAP_BASE_DN = "ldap.base.dn";
String PROP_LDAP_USER_SEARCH_BASE = "ldap.user.search.base";
String PROP_LDAP_USER_SEARCH_FILTER = "ldap.user.search.filter";
String PROP_LDAP_USER_DISPLAY_NAME = "ldap.user.display_name";
String PROP_LDAP_USER_EMAIL = "ldap.user.email";
String PROP_LDAP_MANAGER_DN = "ldap.manager.dn";
String PROP_LDAP_MANAGER_PASSWORD = "ldap.manager.password";
String PROP_LDAP_CONNECT_TIMEOUT = "ldap.connect.timeout";
String PROP_LDAP_RESPONSE_TIMEOUT = "ldap.response.timeout";
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class Config extends AbstractConfig implements ControllerConstants, Clust
private PropertiesWrapper controllerProperties;
private PropertiesWrapper databaseProperties;
private PropertiesWrapper clusterProperties;
private PropertiesWrapper ldapProperties;
private String announcement = "";
private Date announcementDate;
private boolean verbose;
Expand All @@ -89,6 +90,7 @@ public class Config extends AbstractConfig implements ControllerConstants, Clust
protected PropertiesKeyMapper databasePropertiesKeyMapper = PropertiesKeyMapper.create("database-properties.map");
protected PropertiesKeyMapper controllerPropertiesKeyMapper = PropertiesKeyMapper.create("controller-properties.map");
protected PropertiesKeyMapper clusterPropertiesKeyMapper = PropertiesKeyMapper.create("cluster-properties.map");
protected PropertiesKeyMapper ldapPropertiesKeyMapper = PropertiesKeyMapper.create("ldap-properties.map");

@SuppressWarnings("SpringJavaAutowiringInspection")
@Autowired
Expand Down Expand Up @@ -388,6 +390,7 @@ public synchronized void loadProperties() {
// Override if exists
controllerProperties = new PropertiesWrapper(properties, controllerPropertiesKeyMapper);
clusterProperties = new PropertiesWrapper(properties, clusterPropertiesKeyMapper);
ldapProperties = new PropertiesWrapper(properties, ldapPropertiesKeyMapper);
}

/**
Expand Down Expand Up @@ -706,6 +709,10 @@ public PropertiesWrapper getClusterProperties() {
return clusterProperties;
}

public PropertiesWrapper getLdapProperties() {
return ldapProperties;
}

/**
* Get the time out milliseconds which would be used between the console and the agent while preparing to test.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2012-present NAVER Corp.
*
* This file is part of The nGrinder software distribution. Refer to
* the file LICENSE which is part of The nGrinder distribution for
* licensing details. The nGrinder distribution is available on the
* Internet at https://naver.github.io/ngrinder
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ngrinder.infra.config;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.text.SimpleDateFormat;

@Configuration
public class JacksonConfig {
@Bean
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
return customizer -> {
customizer.serializationInclusion(JsonInclude.Include.NON_NULL);
customizer.indentOutput(true);
customizer.timeZone("GMT");
customizer.dateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"));
customizer.modules(new NumberModule());
};
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.ngrinder.infra.config;

import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -8,9 +10,17 @@
import org.springframework.context.support.AbstractResourceBasedMessageSource;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.netty.http.client.HttpClient;

import javax.net.ssl.SSLException;

import static io.netty.handler.ssl.util.InsecureTrustManagerFactory.INSTANCE;
import static org.springframework.web.reactive.function.client.WebClient.builder;

@Configuration
@EnableTransactionManagement(proxyTargetClass = true)
Expand All @@ -25,4 +35,14 @@ public class SpringConfig {
public AbstractResourceBasedMessageSource reloadableResourceBundleMessageSource(){
return new ReloadableResourceBundleMessageSource();
}

@Bean
public WebClient webClient() throws SSLException {
SslContext sslContext = SslContextBuilder
.forClient()
.trustManager(INSTANCE)
.build();
HttpClient httpClient = HttpClient.create().secure(sslProviderBuilder -> sslProviderBuilder.sslContext(sslContext));
return builder().clientConnector(new ReactorClientHttpConnector(httpClient)).build();
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package org.ngrinder.infra.config;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver;
import org.ngrinder.infra.interceptor.DefaultSuccessJsonInterceptor;
import org.ngrinder.infra.spring.ApiExceptionHandlerResolver;
import org.ngrinder.infra.spring.RemainedPathMethodArgumentResolver;
import org.ngrinder.infra.spring.UserHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.boot.autoconfigure.web.ResourceProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
Expand All @@ -26,7 +24,6 @@
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;

import java.text.SimpleDateFormat;
import java.util.List;

@Configuration
Expand Down Expand Up @@ -126,16 +123,4 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
, "/**/*.woff" , "/**/*.ttf"};
registry.addResourceHandler(staticPathPatterns).addResourceLocations(this.resourceProperties.getStaticLocations()).setCachePeriod(3600);
}


@Bean
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
return customizer -> {
customizer.serializationInclusion(JsonInclude.Include.NON_NULL);
customizer.indentOutput(true);
customizer.timeZone("GMT");
customizer.dateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"));
customizer.modules(new NumberModule());
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (c) 2012-present NAVER Corp.
*
* This file is part of The nGrinder software distribution. Refer to
* the file LICENSE which is part of The nGrinder distribution for
* licensing details. The nGrinder distribution is available on the
* Internet at https://naver.github.io/ngrinder
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ngrinder.infra.webhook.controller;

import lombok.RequiredArgsConstructor;
import org.ngrinder.infra.webhook.model.WebhookActivation;
import org.ngrinder.infra.webhook.model.WebhookConfig;
import org.ngrinder.infra.webhook.service.WebhookActivationService;
import org.ngrinder.infra.webhook.service.WebhookConfigService;
import org.ngrinder.infra.webhook.service.WebhookService;
import org.ngrinder.model.User;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static org.ngrinder.infra.webhook.model.Event.FINISH;

@RestController
@RequiredArgsConstructor
@RequestMapping("/webhook/api")
public class WebhookApiController {

private final WebhookConfigService webhookConfigService;

private final WebhookService webhookService;

private final WebhookActivationService webhookActivationService;

@PostMapping
public void save(@RequestBody WebhookConfig webhookConfig) {
webhookConfigService.save(webhookConfig);
}

@PostMapping("/validate")
public void validatePayloadUrl(User user, @RequestBody WebhookConfig webhookConfig) {
webhookService.sendDummyWebhookRequest(user, webhookConfig, FINISH);
}

@GetMapping
public WebhookConfig getOne(User user) {
return webhookConfigService.getOne(user.getUserId());
}

@GetMapping("/activation")
public List<WebhookActivation> getActivations(@RequestParam String createdUserId,
@PageableDefault Pageable pageable) {
return webhookActivationService.findAll(createdUserId, pageable);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2012-present NAVER Corp.
*
* This file is part of The nGrinder software distribution. Refer to
* the file LICENSE which is part of The nGrinder distribution for
* licensing details. The nGrinder distribution is available on the
* Internet at https://naver.github.io/ngrinder
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ngrinder.infra.webhook.controller;

import org.ngrinder.common.controller.annotation.GlobalControllerModel;
import org.ngrinder.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@GlobalControllerModel
@RequestMapping("/webhook")
public class WebhookController {

@GetMapping("/settings")
public String webhookSettings(User user) {
return "app";
}
}
Loading

0 comments on commit 813cd0a

Please sign in to comment.