CAS 7.2.x Geolocation

180 views
Skip to first unread message

AJ

unread,
Jun 25, 2025, 10:17:36 AMJun 25
to 'Richard Frovarp' via CAS Community
Has anyone gotten geolocation data to actually be written to the events system without having to have user consent in their browsers?
I have tried various geo location services, Maxmind, IP, Azure and none of them work.  The only time it works is if the user is prompted in the browser and they accept.
I'm looking to capture geolocation data based on their IP address only.  

I have these settings:

cas.tgc.geo-locate-client-session=true
cas.authn.adaptive.risk.geo-location.enabled=true
cas.authn.adaptive.risk.ip.enabled=true
cas.events.core.enabled=true
cas.events.core.track-geolocation=true
cas.geo-location.maxmind.city-database=/etc/cas/config/geodb/geoip-city.mmdb
cas.geo-location.maxmind.country-database=/etc/cas/config/geodb/geoip-country.mmdb

Obviously, I should not need user permission to just translate their IP to a geolocation.

If it matters, I am using MongoDB for event storage.

CAS version 7.2.3


AJ

unread,
Jun 25, 2025, 12:31:27 PMJun 25
to 'Richard Frovarp' via CAS Community
I've turned up logging to trace and I see the following for both Azure and Maxmind services.

 <Geo location for [/x.x.x.x] is calculated as [GeoLocationResponse(addresses=[], latitude=0.0, longitude=0.0)]>

It looks like it's trying to resolve the geolocation, but it always returns 0's.  Looking the IP up manually from the service of course returns the proper results.
Only thing I notice is there is a forward slash (/) in front of the IP address. 

Thanks.


From: AJ
Sent: Wednesday, June 25, 2025 10:03 AM
To: CAS Community <cas-...@apereo.org>
Subject: CAS 7.2.x Geolocation
 

AJ

unread,
Jun 27, 2025, 12:06:26 PMJun 27
to 'Richard Frovarp' via CAS Community
Just to update, this behavior is the same in CAS 7.2.4.

2025-06-27 11:52:03,261 DEBUG [org.apereo.cas.support.geo.maxmind.MaxmindDatabaseGeoLocationService] - <Geo location for [/x.x.x.x] is calculated as [GeoLocationResponse(addresses=[], latitude=0.0, longitude=0.0)]>

None of the Geolocation services work, all return zeroes.




From: AJ <a...@mindcrash.com>
Sent: Wednesday, June 25, 2025 12:12 PM
To: CAS Community <cas-...@apereo.org>
Subject: Re: CAS 7.2.x Geolocation
 

Petr Bodnár

unread,
Nov 1, 2025, 11:41:08 AMNov 1
to CAS Community, AJ
Hi AJ,

have you managed to resolve the issue? Do I expect it correctly that the mmdb files referenced in your CAS properties are not just the example ones?

Regarding the slash, it seems like the extra slash before the logged IP address should be just fine, because that's how java.net.InetAddress#toString() is implemented:

    public String toString() {
        String hostName = holder().getHostName();
        return Objects.toString(hostName, "")
            + "/" + getHostAddress();
    }

Regards
Petr
Reply all
Reply to author
Forward
0 new messages