That's great. Glad you figured it out. --
DAVID A. CURRY, CISSP *DIRECTOR • INFORMATION SECURITY & PRIVACY* THE NEW SCHOOL • INFORMATION TECHNOLOGY 71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003 +1 646 909-4728 • [email protected] On Tue, Aug 25, 2020 at 10:49 AM Nguyen Tran Thanh Lam < [email protected]> wrote: > Dear Mr David. > I have success. > Thank you very much. > > Vào Th 3, 25 thg 8, 2020 vào lúc 21:21 Nguyen Tran Thanh Lam < > [email protected]> đã viết: > >> Dear Mr David Curry, >> I have read the guide from your link. >> Then I setup follow these step bellow: >> *Step 1:* >> I keep two properties in my CAS configuration to initialized CAS server >> load some services in directory /etc/cas/services-repo to mongoDB >> >> "name":"cas.service-registry.json.location","value":"file:/etc/cas/services-repo" >> "name":"cas.service-registry.mongo.drop-collection","value":"true" >> Then I build CAS server (First time). >> Result, >> -CAS create collection "cas-service-registry" >> -loaded to this collection >> Done. >> *Step 2:* >> I stop CAS and remove two properties above. >> Then I build CAS again. >> Now CAS works with service registry in MongoDB >> Here is my logs: >> 2020-08-25 07:00:03,217 INFO >> [org.apereo.cas.services.AbstractServicesManager] - <Loaded [4] service(s) >> from [MongoDbServiceRegistry].> >> *Step 3:* >> I build my CAS Management Web App >> Then I create a new service >> But It still didn't store my new service registry in collection >> "cas-service-registry". >> It create new json file for this service and store this file in directory >> "/etc/cas/service-repo" >> Here is CAS Management log >> 2020-08-25 06:55:29,029 INFO >> [org.apereo.cas.mgmt.web.CasManagementWebApplication] - <The following >> profiles are active: mongodb> >> 2020-08-25 06:55:58,528 INFO >> [org.apereo.cas.authentication.config.CasMongoAuthenticationConfiguration] >> - <Connected to MongoDb instance using mongo client >> [Mongo{options=MongoClientOptions{description='null', >> applicationName='null', compressors='[]', readPreference=primary, >> writeConcern=WriteConcern{w=null, wTimeout=null ms, fsync=null, >> journal=null, retryWrites=false, readConcern=com.mongodb.ReadConcern@0, >> codecRegistry=org.bson.codecs.configuration.ProvidersCodecRegistry@ac36d621, >> serverSelector=null, clusterListeners=[], commandListeners=[], >> minConnectionsPerHost=0, maxConnectionsPerHost=10, >> threadsAllowedToBlockForConnectionMultiplier=5, >> serverSelectionTimeout=30000, maxWaitTime=120000, >> maxConnectionIdleTime=30000, maxConnectionLifeTime=60000, >> connectTimeout=5000, socketTimeout=5000, socketKeepAlive=false, >> sslEnabled=false, sslInvalidHostNamesAllowed=false, >> sslContext=javax.net.ssl.SSLContext@52f9e8bb, alwaysUseMBeans=false, >> heartbeatFrequency=10000, minHeartbeatFrequency=500, >> heartbeatConnectTimeout=5000, heartbeatSocketTimeout=5000, >> localThreshold=15, requiredReplicaSetName='null', >> dbDecoderFactory=com.mongodb.DefaultDBDecoder$1@2035d65b, >> dbEncoderFactory=com.mongodb.DefaultDBEncoder$1@240a2619, >> socketFactory=null, cursorFinalizerEnabled=true, >> connectionPoolSettings=ConnectionPoolSettings{maxSize=10, minSize=0, >> maxWaitQueueSize=50, maxWaitTimeMS=120000, maxConnectionLifeTimeMS=60000, >> maxConnectionIdleTimeMS=30000, maintenanceInitialDelayMS=0, >> maintenanceFrequencyMS=60000, connectionPoolListeners=[]}, >> socketSettings=SocketSettings{connectTimeoutMS=5000, readTimeoutMS=5000, >> keepAlive=false, receiveBufferSize=0, sendBufferSize=0}, >> serverSettings=ServerSettings{heartbeatFrequencyMS=10000, >> minHeartbeatFrequencyMS=500, serverListeners='[]', >> serverMonitorListeners='[]'}, >> heartbeatSocketSettings=SocketSettings{connectTimeoutMS=5000, >> readTimeoutMS=5000, keepAlive=false, receiveBufferSize=0, >> sendBufferSize=0}}}]> >> 2020-08-25 06:56:02,609 INFO >> [org.apereo.cas.mgmt.factory.FormDataFactory] - <CAS Server returned 404 >> status code from endpoint >> https://casoverlay.vdc2.com.vn:8443/cas/actuator/discoveryProfile. Using >> default FormData values.> >> 2020-08-25 06:56:07,754 INFO >> [org.apereo.cas.mgmt.web.CasManagementWebApplication] - <Started >> CasManagementWebApplication in 53.965 seconds (JVM running for 62.606)> >> 2020-08-25 06:56:09,008 INFO >> [org.apereo.cas.services.AbstractServicesManager] - <Loaded [3] service(s) >> from [MongoDbServiceRegistry].> >> 2020-08-25 06:56:09,009 INFO >> [org.apereo.cas.mgmt.web.DefaultCasManagementEventListener] - <> >> 2020-08-25 06:56:09,015 INFO >> [org.apereo.cas.mgmt.web.DefaultCasManagementEventListener] - < >> >> ____ _____ _ ____ __ __ >> | _ \ | ____| / \ | _ \ \ \ / / >> | |_) | | _| / _ \ | | | | \ V / >> | _ < | |___ / ___ \ | |_| | | | >> |_| \_\ |_____| /_/ \_\ |____/ |_| >> 2020-08-25 06:59:23,275 INFO >> [org.apereo.cas.services.AbstractServicesManager] - <Loaded [4] service(s) >> from [JsonServiceRegistry].> >> 2020-08-25 06:59:26,788 INFO >> [org.apereo.cas.services.AbstractServicesManager] - <Loaded [3] service(s) >> from [MongoDbServiceRegistry].> >> 2020-08-25 07:00:26,804 INFO >> [org.apereo.cas.services.AbstractServicesManager] - <Loaded [3] service(s) >> from [MongoDbServiceRegistry].> >> 2020-08-25 07:00:59,350 INFO >> [org.apereo.cas.services.AbstractServicesManager] - <Loaded [4] service(s) >> from [JsonServiceRegistry].> >> 2020-08-25 07:00:59,428 INFO >> [org.apereo.cas.mgmt.controller.ServiceController] - <Saved changes to >> service [1598364059353]> >> 2020-08-25 07:00:59,485 INFO >> [org.apereo.cas.services.AbstractServicesManager] - <Loaded [5] service(s) >> from [JsonServiceRegistry].> >> >> I don't know what does it wrong? >> P/s: here is my CAS config and CAS Management config >> 1. CAS >> "name":"cas.service-registry.mongo.host","value":"203.162.141.22" >> "name":"cas.service-registry.mongo.client-uri","value":"mongodb:// >> casuser:[email protected]:27017/cas?authSource=admin&readPreference=primary&appname=MongoDB%20Compass%20Community&ssl=false >> " >> "name":"cas.service-registry.mongo.port","value":"27017" >> "name":"cas.service-registry.mongo.password","value":"Mellon" >> >> "name":"cas.service-registry.mongo.collection","value":"cas-service-registry" >> "name":"cas.service-registry.mongo.database-name","value":"cas" >> "name":"cas.service-registry.mongo.user-id","value":"casuser" >> "name":"cas.service-registry.mongo.write-concern","value":"NORMAL" >> "name":"cas.service-registry.mongo.ssl-enabled","value":"false" >> "name":"cas.service-registry.watcher-enabled","value":"true" >> "name":"cas.service-registry.mongo.drop-collection","value":"false" >> 2.CAS Management >> "name":"cas.service-registry.mongo.host","value":"203.162.141.22" >> "name":"cas.service-registry.mongo.client-uri","value":"mongodb:// >> casuser:[email protected]:27017/cas?authSource=admin&readPreference=primary&appname=MongoDB%20Compass%20Community&ssl=false >> " >> "name":"cas.service-registry.mongo.port","value":"27017" >> "name":"cas.service-registry.mongo.password","value":"Mellon" >> >> "name":"cas.service-registry.mongo.collection","value":"cas-service-registry" >> "name":"cas.service-registry.mongo.database-name","value":"cas" >> "name":"cas.service-registry.mongo.user-id","value":"casuser" >> "name":"cas.service-registry.mongo.ssl-enabled","value":"false" >> "name":"cas.service-registry.mongo.drop-collection","value":"false" >> >> Please help me. >> Thank you. >> >> Vào Th 3, 25 thg 8, 2020 vào lúc 19:35 David Curry < >> [email protected]> đã viết: >> >>> You need to *turn off* the JSON registry in cas.properties so the server >>> will stop using it, and put the mongodb settings into cas.properties (and >>> management.properties) so the server will use it instead. >>> >>> These instructions are for CAS 5.2.x so might not be exactly right for >>> CAS 6.x (property names might be slightly different, etc.) but it should >>> give you the basic idea: >>> >>> >>> https://dacurry-tns.github.io/deploying-apereo-cas/high-avail_service-registry_overview.html >>> >>> >>> --Dave >>> >>> -- >>> >>> DAVID A. CURRY, CISSP >>> *DIRECTOR • INFORMATION SECURITY & PRIVACY* >>> THE NEW SCHOOL • INFORMATION TECHNOLOGY >>> >>> 71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003 >>> +1 646 909-4728 • [email protected] >>> >>> >>> On Tue, Aug 25, 2020 at 8:21 AM Nguyen Tran Thanh Lam < >>> [email protected]> wrote: >>> >>>> Hi Mr David Curry, >>>> I understand your point. >>>> But when I use CAS server, I want to register my new service, what >>>> should I do? >>>> I can use CAS Management Web app to register my new service but, it >>>> still only create a json file in directory /etc/cas/services-repo. >>>> I have tried to config my CAS Management Web to insert new register >>>> service directly to MongoDB, but it still didn't work. >>>> Please help me. >>>> Note: my CAS version is 6.2.1 and my CAS Management Overlay Web App is >>>> 6.1.2 (the newest version) >>>> Here is my CAS Mamagement Web App Configuration: >>>> 1. build.gradle >>>> compile >>>> "org.apereo.cas:cas-server-webapp-tomcat:${casMgmtServerVersion}" >>>> compile >>>> "org.apereo.cas:cas-server-support-configuration-cloud-mongo:${casMgmtServerVersion}" >>>> compile >>>> "org.apereo.cas:cas-server-support-mongo:${casMgmtServerVersion}" >>>> compile >>>> "org.apereo.cas:cas-server-support-mongo-service-registry:${casMgmtServerVersion}" >>>> 2. Cas Management Global config in MongoDB >>>> "name":"cas.server.name","value":"https://casoverlay.vdc2.com.vn:8443" >>>> "name":"cas.server.prefix","value":"${cas.server.name}/cas" >>>> "name":"mgmt.serverName","value":"https://casoverlay.vdc2.com.vn:8088" >>>> "name":"mgmt.adminRoles[0]","value":"ROLE_ADMIN" >>>> >>>> "name":"mgmt.userPropertiesFile","value":"file:/etc/cas/config/users.json" >>>> "name":"mgmt.userRoles[0]","value":"ROLE_USER" >>>> "name":"spring.thymeleaf.mode","value":"HTML" >>>> "name":"server.port","value":"8088" >>>> "name":"server.ssl.enabled","value":"true"} >>>> "name":"server.ssl.keyStore","value":"file:/etc/cas/thekeystore" >>>> "name":"server.ssl.keyStorePassword","value":"changeit" >>>> "name":"server.ssl.keyPassword","value":"changeit" >>>> "name":"cas.service-registry.mongo.host","value":"203.162.141.22" >>>> "name":"cas.service-registry.mongo.client-uri","value":"mongodb:// >>>> casuser:[email protected]:27017/cas?authSource=admin&readPreference=primary&appname=MongoDB%20Compass%20Community&ssl=false >>>> " >>>> "name":"cas.service-registry.mongo.port","value":"27017" >>>> "name":"cas.service-registry.mongo.password","value":"Mellon" >>>> >>>> "name":"cas.service-registry.mongo.collection","value":"cas-service-registry" >>>> "name":"cas.service-registry.mongo.database-name","value":"cas" >>>> "name":"cas.service-registry.mongo.user-id","value":"casuser" >>>> "name":"cas.service-registry.mongo.ssl-enabled","value":"false" >>>> "name":"cas.service-registry.mongo.drop-collection","value":"false" >>>> Please help me. >>>> Thank you in advance. >>>> >>>> Vào Th 3, 25 thg 8, 2020 vào lúc 19:00 David Curry < >>>> [email protected]> đã viết: >>>> >>>>> It doesn't do that because it's not supposed to. >>>>> >>>>> Populating an alternate service registry (MongoDB or whatever) from >>>>> the JSON files is a one-time thing the server does to help you "bootstrap" >>>>> the alternate service registry. After that, you don't need the JSON files >>>>> any more (and should turn that registry off). You use the cas-management >>>>> application to manage the service registry from that point forward. >>>>> >>>>> >>>>> -- >>>>> >>>>> DAVID A. CURRY, CISSP >>>>> *DIRECTOR • INFORMATION SECURITY & PRIVACY* >>>>> THE NEW SCHOOL • INFORMATION TECHNOLOGY >>>>> >>>>> 71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003 >>>>> +1 646 909-4728 • [email protected] >>>>> >>>>> >>>>> On Tue, Aug 25, 2020 at 5:46 AM Napoleon Ponaparte < >>>>> [email protected]> wrote: >>>>> >>>>>> >>>>>> I am successful store service registry in MongoDB, but I have a >>>>>> trouble in there. >>>>>> >>>>>> If I register new service store in directory /etc/cas/services-repo, >>>>>> CAS server didn't auto store this service to MongoDB. I must restart CAS >>>>>> to >>>>>> do this. >>>>>> >>>>>> So, How could config CAS auto restart to load new service registry to >>>>>> MongoDB? >>>>>> >>>>>> Note: My CAS server at version 6.2.x. >>>>>> >>>>>> Thank you in advance. >>>>>> >>>>>> -- >>>>>> - Website: https://apereo.github.io/cas >>>>>> - Gitter Chatroom: https://gitter.im/apereo/cas >>>>>> - List Guidelines: https://goo.gl/1VRrw7 >>>>>> - Contributions: https://goo.gl/mh7qDG >>>>>> --- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "CAS Community" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/a/apereo.org/d/msgid/cas-user/bbb8c8b6-a16e-4e94-88e3-74e2dd80a934n%40apereo.org >>>>>> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/bbb8c8b6-a16e-4e94-88e3-74e2dd80a934n%40apereo.org?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>>> - Website: https://apereo.github.io/cas >>>>> - Gitter Chatroom: https://gitter.im/apereo/cas >>>>> - List Guidelines: https://goo.gl/1VRrw7 >>>>> - Contributions: https://goo.gl/mh7qDG >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "CAS Community" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/a/apereo.org/d/msgid/cas-user/CA%2Bd9XAOimF2-vHL-13Uj0vs98gcxpzZPQh%2Be1r4sUBBY_hYxvg%40mail.gmail.com >>>>> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/CA%2Bd9XAOimF2-vHL-13Uj0vs98gcxpzZPQh%2Be1r4sUBBY_hYxvg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>>> - Website: https://apereo.github.io/cas >>>> - Gitter Chatroom: https://gitter.im/apereo/cas >>>> - List Guidelines: https://goo.gl/1VRrw7 >>>> - Contributions: https://goo.gl/mh7qDG >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "CAS Community" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAEjUsAi01fJsDVKPctfj%2BjrMLhUq-wjSK4bpbY6yeBq6_e0wCw%40mail.gmail.com >>>> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAEjUsAi01fJsDVKPctfj%2BjrMLhUq-wjSK4bpbY6yeBq6_e0wCw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> - Website: https://apereo.github.io/cas >>> - Gitter Chatroom: https://gitter.im/apereo/cas >>> - List Guidelines: https://goo.gl/1VRrw7 >>> - Contributions: https://goo.gl/mh7qDG >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "CAS Community" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/a/apereo.org/d/msgid/cas-user/CA%2Bd9XAMGVG6zZ_zUs5jz5w5rfOcZvvMecndkyEYX7CtPKEiEiQ%40mail.gmail.com >>> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/CA%2Bd9XAMGVG6zZ_zUs5jz5w5rfOcZvvMecndkyEYX7CtPKEiEiQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- - Website: https://apereo.github.io/cas - Gitter Chatroom: https://gitter.im/apereo/cas - List Guidelines: https://goo.gl/1VRrw7 - Contributions: https://goo.gl/mh7qDG --- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/CA%2Bd9XAP_ZQ3yWUPXaL9pSN5mSALf%3DuBtvsucsV%3Dsb3gkqvnK%3Dg%40mail.gmail.com.
