db service and it's server is in java, I'm using tomcat to display whole DB on a webpage, now I want to protect that webpage(offline i.e. client don't req internet connection to login), what should I use to achieve the same?
should I simply store username n pw in the server and make it read only?
and should I make a login page and make a common json file that sets something like {"auth": "true"} on loginSuccess and redirect it to the db page; and when that's loaded it set's auth to false.
Ik this is the worst auth I could provide but I don't need some fancy auth system, but pls tell me if there's some better way and that does not consume much time to make.
It feels like you have not very clear understanding how server-client web applications work in general. I recommend you to first spend some time on this topic. Just explore how web apps usually work, how http is used there, etc. (I have no idea about that "offline part", I'm pretty sure you're not talking about PWAs, thus it's just doesn't make sense for web applications to "authenticate offline") After that search for "http basic auth", this is the easiest way. And the way of implementing it highly depends on the framework you're using, so google for "<your framework> http basic auth".
With offline auth I mean just like how you log into your computer. Basically the webpage is supposed to access only by 1 person and the server file would be destributed to a people as a whole and webpage is part of it so I don't want to use proper auth(like google auth) and make them use internet
Why you need "server in java" then? Can you explain what exactly your application is about? You're talking too abstract, and in general the design you came up with doesn't make much sense.
As I said I've made a realtime database service, with server I mean the server which maintains the JSON and responds to the requests what clients make. With clients I mean the android/iOS/any other client which uses my dependency. GitHub.com/ssddcodes/ssddrtdb here's it explains how to use it (as a client)
And in the server I've used tomcat and to pretty print and edit the json.
Perfect! So now let's say I deploy this service in Finland, so the data is stored on some disk that is physically in Finland. And people in Germany, Australia and India are connecting to it and doing crud operations with it. What do you mean by "offline, don't have internet connection"? Imagine that the data center in Finland is hit by snow storm and there's power outage there, it doesn't work. Data stored on that disk is physically unreachable. What do you expect people in Germany, Australia and India to see on their apps when they launch them? And what they are expected to authenticate against? (in other words, whom should they prove their identity, who should verify their passwords and logins?
For it's main functions like createing and updating fields they don't req auth that's a ws connection, for that auth is different, it's done by app's package id and certificate. But the person having access to the webpage have access to full database and can edit anything (which clients can not as owner can set permissions for the fields) I just want to protect that. The reason I want it offline is imagine there's a hotel using this on their local server so they don't have to connect to internet and pay for bandwidth whatsoever and if I add google login or something they need internet. Finally thx for the situation tho, currently they need physical access or need to see the content(however if the user have the port open for the database they can still access it remotely)
Ah, that explains it! I mistook "no internet" for "no network connection between web client and server". Google for "http basic auth", it's basically sending username and password with http request approach. Should do the trick for your case. For example redis auth is similarly simple and basic.
Yes but where/how to store the auth credentials I want it to be offline too so need to store credentials in server itself, that's what my question is, how to save credentials so people can't access it easily
No, jar is readonly. Think of jar as ".exe" file in windows. Or like game data files in games. Data in that files is same for millions of installations. But personal configurations, or game saves files, they are individual and they are not part of distribution, they are created individually for each individual installation.
🤔 earlier I kept and used a json file in the jar itself and I was able to edit and read it without any complications
Обсуждают сегодня