From 50daef5bdc03ee2ca42629b1fb6da58182e605c6 Mon Sep 17 00:00:00 2001 From: Seun Matt Date: Mon, 6 Nov 2017 22:23:20 +0100 Subject: [PATCH] Refactor Cas-Server Configurations (#2970) * added updated example codes * updated example code StringToCharStream * deleted StringToCharStream.java locally * removed redundant file * added code for apache commons collection SetUtils * refactored example code * added example code for bytebuddy * added example code for PCollections * update pom * refactored tests for PCollections * spring security xml config * spring security xml config * remove redundant comment * example code for apache-shiro * updated example code for Vavr Collections * updated Vavr's Collection example * updated Vavr Collection file * updated example code for Apache Shiro * updated Vavr Collections example * added example code for N1QL * update example code for N1QL * added integration test for N1QL * update N1QL Example code * update the N1QL example Code * rename module to couchbase * rename module to couchbase * change module name in parent module and pom * added cas-server module * added cas secured app for Spring SSO with CAS * refactor cas modules into cas folder * updated files * removed redundant files * refactor the config for cas-server --- .../CasSecuredAppApplication.java | 8 +- cas/cas-server/etc/cas/thekeystore | Bin 2225 -> 0 bytes cas/cas-server/etc/cas/thekeystore.crt | Bin 808 -> 0 bytes .../src/main/resources/application.properties | 16 ++- .../src/main/resources/cas.properties | 7 +- .../resources/etc/cas/config/application.yml | 2 + .../resources/etc/cas/config/cas.properties | 7 ++ .../main/resources/etc/cas/config/log4j2.xml | 117 ++++++++++++++++++ .../src/main/resources/etc/cas/thekeystore | Bin 0 -> 2243 bytes .../main/resources/etc/cas/thekeystore.crt | Bin 0 -> 885 bytes 10 files changed, 145 insertions(+), 12 deletions(-) delete mode 100644 cas/cas-server/etc/cas/thekeystore delete mode 100644 cas/cas-server/etc/cas/thekeystore.crt create mode 100644 cas/cas-server/src/main/resources/etc/cas/config/application.yml create mode 100644 cas/cas-server/src/main/resources/etc/cas/config/cas.properties create mode 100644 cas/cas-server/src/main/resources/etc/cas/config/log4j2.xml create mode 100644 cas/cas-server/src/main/resources/etc/cas/thekeystore create mode 100644 cas/cas-server/src/main/resources/etc/cas/thekeystore.crt diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredAppApplication.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredAppApplication.java index fc05e3b38f..25cbb9bc9b 100644 --- a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredAppApplication.java +++ b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredAppApplication.java @@ -40,14 +40,14 @@ public class CasSecuredAppApplication { @Primary public AuthenticationEntryPoint authenticationEntryPoint(ServiceProperties sP) { CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint(); - entryPoint.setLoginUrl("https://localhost:8443/cas/login"); + entryPoint.setLoginUrl("https://localhost:6443/cas/login"); entryPoint.setServiceProperties(sP); return entryPoint; } @Bean public TicketValidator ticketValidator() { - return new Cas30ServiceTicketValidator("https://localhost:8443/cas"); + return new Cas30ServiceTicketValidator("https://localhost:6443/cas"); } @Bean @@ -71,7 +71,7 @@ public class CasSecuredAppApplication { @Bean public LogoutFilter logoutFilter() { LogoutFilter logoutFilter = new LogoutFilter( - "https://localhost:8443/cas/logout", securityContextLogoutHandler()); + "https://localhost:6443/cas/logout", securityContextLogoutHandler()); logoutFilter.setFilterProcessesUrl("/logout/cas"); return logoutFilter; } @@ -79,7 +79,7 @@ public class CasSecuredAppApplication { @Bean public SingleSignOutFilter singleSignOutFilter() { SingleSignOutFilter singleSignOutFilter = new SingleSignOutFilter(); - singleSignOutFilter.setCasServerUrlPrefix("https://localhost:8443/cas"); + singleSignOutFilter.setCasServerUrlPrefix("https://localhost:6443/cas"); singleSignOutFilter.setIgnoreInitConfiguration(true); return singleSignOutFilter; } diff --git a/cas/cas-server/etc/cas/thekeystore b/cas/cas-server/etc/cas/thekeystore deleted file mode 100644 index 15f9af2dae6366804459009361140e8526f811b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2225 zcmchY`8yPf8pmfdWEuM;h2bD;Mv*NOWhsn(m>Fv^MPo*m3LR5skg?5;Ff}bih^QF* z+LSqxeJ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je@cd?>@yn!q*S;_LTh_Q&YJHHb@cHKCaG5K^|-kqbb z71xQ*LrK-l1`Gzez;KTy%+P+Cq182x$hPylZc<7u@rwr-~sU~Z@s>F Lt(?_lzc& diff --git a/cas/cas-server/src/main/resources/application.properties b/cas/cas-server/src/main/resources/application.properties index 2d5e9a7277..afacd4cbc1 100644 --- a/cas/cas-server/src/main/resources/application.properties +++ b/cas/cas-server/src/main/resources/application.properties @@ -2,9 +2,9 @@ # CAS Server Context Configuration # server.context-path=/cas -server.port=8443 +server.port=6443 -server.ssl.key-store=file:/etc/cas/thekeystore +server.ssl.key-store=classpath:/etc/cas/thekeystore server.ssl.key-store-password=changeit server.ssl.key-password=changeit # server.ssl.ciphers= @@ -40,6 +40,12 @@ spring.http.encoding.charset=UTF-8 spring.http.encoding.enabled=true spring.http.encoding.force=true +## +#CAS CONFIG LOCATION +# +cas.standalone.config=classpath:/etc/cas/config + + ## # CAS Cloud Bus Configuration # @@ -82,6 +88,7 @@ spring.thymeleaf.mode=HTML # CAS Log4j Configuration # # logging.config=file:/etc/cas/log4j2.xml + server.context-parameters.isLog4jAutoInitializationDisabled=true ## @@ -104,9 +111,10 @@ cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect cas.authn.jdbc.query[0].user=root cas.authn.jdbc.query[0].password= cas.authn.jdbc.query[0].ddlAuto=none -cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver +#cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver +cas.authn.jdbc.query[0].driverClass=com.mysql.cj.jdbc.Driver cas.authn.jdbc.query[0].fieldPassword=password -cas.authn.jdbc.query[0].passwordEncoder.type=BCRYPT +cas.authn.jdbc.query[0].passwordEncoder.type=NONE ## diff --git a/cas/cas-server/src/main/resources/cas.properties b/cas/cas-server/src/main/resources/cas.properties index be2babcd14..f80f22fc11 100644 --- a/cas/cas-server/src/main/resources/cas.properties +++ b/cas/cas-server/src/main/resources/cas.properties @@ -1,16 +1,15 @@ -cas.server.name: https://localhost:8443 -cas.server.prefix: https://localhost:8443/cas +cas.server.name: https://localhost:6443 +cas.server.prefix: https://localhost:643/cas cas.adminPagesSecurity.ip=127\.0\.0\.1 -logging.config: file:/etc/cas/config/log4j2.xml - cas.serviceRegistry.initFromJson=true cas.serviceRegistry.config.location=classpath:/services cas.authn.accept.users= cas.authn.accept.name= + #CAS Database Authentication Property # cas.authn.jdbc.query[0].healthQuery= diff --git a/cas/cas-server/src/main/resources/etc/cas/config/application.yml b/cas/cas-server/src/main/resources/etc/cas/config/application.yml new file mode 100644 index 0000000000..be1f7c3edd --- /dev/null +++ b/cas/cas-server/src/main/resources/etc/cas/config/application.yml @@ -0,0 +1,2 @@ +info: + description: CAS Configuration \ No newline at end of file diff --git a/cas/cas-server/src/main/resources/etc/cas/config/cas.properties b/cas/cas-server/src/main/resources/etc/cas/config/cas.properties new file mode 100644 index 0000000000..47a1477308 --- /dev/null +++ b/cas/cas-server/src/main/resources/etc/cas/config/cas.properties @@ -0,0 +1,7 @@ +cas.server.name: https://cas.example.org:8443 +cas.server.prefix: https://cas.example.org:8443/cas + +cas.adminPagesSecurity.ip=127\.0\.0\.1 + +logging.config: file:/etc/cas/config/log4j2.xml +# cas.serviceRegistry.config.location: classpath:/services diff --git a/cas/cas-server/src/main/resources/etc/cas/config/log4j2.xml b/cas/cas-server/src/main/resources/etc/cas/config/log4j2.xml new file mode 100644 index 0000000000..53b30b4228 --- /dev/null +++ b/cas/cas-server/src/main/resources/etc/cas/config/log4j2.xml @@ -0,0 +1,117 @@ + + + + + + . + + warn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cas/cas-server/src/main/resources/etc/cas/thekeystore b/cas/cas-server/src/main/resources/etc/cas/thekeystore new file mode 100644 index 0000000000000000000000000000000000000000..86170dff16f95409b7f2857a75cba1094b43b5b1 GIT binary patch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2 zrpmsY-LIQ*&~2=sU7{5!6QPzyaI)_0BHc3)QehGFzq|Wr8`!bs8Oy;2xtvB}RN9&OW6hycj6?#tI{ALz6L_Tu7f!RcrqcYcGeO;*gy8rx%w zkM#Ufy5BjeyKjs3axoD<>$1x6%~_e!DHd7_WSed+F*zS}zwi!R@4w45=MR?hhi$Xg za~v#}+@7xJxABSUT@P11H)McdrC~cz>c=!JX=hx9QvPUtGFQe_PAnZa-$5G3iTJzR zI?T+j+73`#oY9|@yRH-D7D3ATn0v=JJ`fj{bK^F3PE%xB=q-|?_yS_*`PI>wUhQ~; z!D%J)Xb(*CJNTgYnIdcKiSo!9AzIj+rtwwz7==f%Gj>(ZVW-r~hv`)aYO|e%+L8cx r$2(t8yGpIvZ)QewhgS{MlKqldYTq&f_lfyx_^8gsEdFM5g;ms__$ADZ literal 0 HcmV?d00001 diff --git a/cas/cas-server/src/main/resources/etc/cas/thekeystore.crt b/cas/cas-server/src/main/resources/etc/cas/thekeystore.crt new file mode 100644 index 0000000000000000000000000000000000000000..5bd9d5babaa13aeb8f33af053456117325b39d3e GIT binary patch literal 885 zcmXqLVlFgjVv1bA%*4pV#3G-u|AYZA8>d#AN85K^Mn-N{27^pPZUas>=1>+kVJ1I! zLp}o@5QjsU)h97MzZk}6hw+6B1VHj!!kjtz$%#1``NbuMP%&;SV$4Wl26E!OhUSKb z24;rFh6W}kQ9!N*kZTC#($gtTj7rD>!N|(M+{DPwV9>W?gSP!NK<`Xq!w{Q9yl2*P;d4-BQN8_b9XUMLTHU zJ5X@Jh#}x<-*uBiskNKG$zAG{zVV^&ZoN{l{b`fT54@Ybt}x$vvV7jLXcwN)f9`MY z2~NtoBHt)i9l2e#RpyfCuAqnoQl}4ku2W3^AaUxjOYH0J%QoA?S?8EP;kYROJ1uqp zM}OV4WuEi+j`zB*Y*>}6DYn9#)jvUHs~2V$qL-VhrL-@4mG<$#R1C>atUzVF#{EN#v_yOy4&@ccHgJ)+1FW zW=00a#fk><2C~5DmgQp+V-cCqqp7*xcDCS6*Vl!wcb!+0=UwBC9EiZw1Pnw*2H$

6bdcT4uOb$?IYv;P~zpOfaTY@GI<^IM8( z?y(o@)7X;8notTXk6wag=_v%H*Ze0Y9tNxs#7-nQHM+9Q*Iwk-Kcm)Nf5>8%b| z6yMnLSSr8%g|%0*PP_iBj>oavQ|c8gH{NL4&XamLHqhdY1k=yFWs