This repository was archived by the owner on Jul 6, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +27
-7
lines changed
src/main/java/com/ericsson/eiffel/remrem/config Expand file tree Collapse file tree 4 files changed +27
-7
lines changed Original file line number Diff line number Diff line change 1+ ## 0.3.2
2+ - Implemented base64 encryption functionality for LDAP manager password
3+
14## 0.3.1
25- Implemented ldap authentication functionality
36
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ apply plugin: 'spring-boot'
2222
2323jar {
2424 baseName = ' remrem-shared'
25- version = ' 0.3.1 '
25+ version = ' 0.3.2 '
2626}
2727ext {
2828 springSecurityVersion = " 1.4.1.RELEASE"
@@ -47,6 +47,9 @@ repositories {
4747dependencies {
4848 compile' com.google.code.gson:gson:2.6.2'
4949 compile(" org.springframework.boot:spring-boot-starter-security:$springSecurityVersion " )
50+ compile(" org.springframework.security:spring-security-ldap:4.1.3.RELEASE" )
51+ compile ' commons-codec:commons-codec:1.10'
52+
5053 compile ' javax.servlet:javax.servlet-api:3.0.1'
5154 testCompile ' junit:junit:4.12'
5255}
Original file line number Diff line number Diff line change 1+ package com .ericsson .eiffel .remrem .config ;
2+
3+ import org .apache .commons .codec .binary .Base64 ;
4+ import org .apache .commons .codec .binary .StringUtils ;
5+
6+ public class Base64Decryption {
7+
8+ // To decrypt Base64 encode ldap manager password
9+ protected String decode (String password ) {
10+ return StringUtils .newStringUtf8 (Base64 .decodeBase64 (password ));
11+ }
12+
13+ }
Original file line number Diff line number Diff line change 11package com .ericsson .eiffel .remrem .config ;
22
3- import org .slf4j .Logger ;
4- import org .slf4j .LoggerFactory ;
53import org .springframework .beans .factory .annotation .Value ;
64import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
75import org .springframework .context .annotation .Configuration ;
@@ -23,19 +21,22 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
2321 @ Value ("${activedirectory.ldapUrl}" )
2422 private String ldapUrl ;
2523
26- @ Value ("${activedirectory.ldapPassword }" )
27- private String ldapPassword ;
24+ @ Value ("${activedirectory.managerPassword }" )
25+ private String managerPassword ;
2826
2927 @ Value ("${activedirectory.managerDn}" )
3028 private String managerDn ;
3129
3230 @ Value ("${activedirectory.userSearchFilter}" )
3331 private String userSearchFilter ;
32+
33+ @ Value ("${activedirectory.rootDn}" )
34+ private String rootDn ;
3435
3536 @ Override
3637 protected void configure (AuthenticationManagerBuilder auth ) throws Exception {
37- auth .ldapAuthentication ().userSearchFilter (userSearchFilter ).contextSource ().managerDn (managerDn )
38- .managerPassword (ldapPassword ).url (ldapUrl );
38+ auth .ldapAuthentication ().userSearchFilter (userSearchFilter ).contextSource ().managerDn (managerDn ). root ( rootDn )
39+ .managerPassword (new Base64Decryption (). decode ( managerPassword ) ).url (ldapUrl );
3940 }
4041
4142 @ Override
You can’t perform that action at this time.
0 commit comments