1. Rob Stevens
  2. PowerServer
  3. Sunday, 4 February 2024 19:23 PM UTC

Hi

We currently have a very basic JWT Authentication model. We are looking to change this model so that the database login information is used as the user name and password for the authentication.

ie. We need to extend the JWT authentication so that it attempts to login to the Oracle database with the provided user name and password. If it succeeds then the authentication can continue, otherwise it fails.

I'm not experienced in .Net. Before I go down trying to work out how to do this, is anyone doing something similar?

I've done a quick search and haven't found something specific to what I'm after, but have found some 'general' links / info which I will start to investigate.

Kind regards

Rob

Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 6 February 2024 19:37 PM UTC
  2. PowerServer
  3. # 1

Hi,

JWT auth implementation code was gently shared by Appeon in the early days of SnapDevelop and C# datastore. 

The extension from sample hardcoded credentials to DB-stored usr/pwd was natural consequence.

So, yes, based on that code snippet, I have personally moved to DB connection, and I do know other developers having done the same too.

Powerserver has been recently enhanced to incorporate same JWT handling code. 

Best,

.m

Comment
  1. Rob Stevens
  2. Tuesday, 6 February 2024 21:35 PM UTC
Hi Marco

If you have already done this are you able to please share the relevant.cs files? (I understand if this is not possible)

AuthenticationMiddleware.cs

AuthenticationExtensions.cs

DatabaseUserStore.cs

etc



Regards

Rob
  1. Helpful
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 6 February 2024 18:45 PM UTC
  2. PowerServer
  3. # 2

Hi Rob,

I guess you followed this PS doc page:

https://docs.appeon.com/ps2022r3/JWT_preparations.html

Now, in order to validate Oracle usr/pwd at login, and thereafter use JWT, you can simply extend the built-in DataBaseUserStore class.

Here the how-to:

https://docs.appeon.com/ps2022r3/Validate_against_database_for_JWT.html

HTH,

.m

Comment
  1. Rob Stevens
  2. Tuesday, 6 February 2024 19:18 PM UTC
Hi, yes, have been through those articles thanks.



We currently use the method where the details are in the DefaultUserStore.cs as we were able to implement this quickly to get basic authentication going. We now need to be more secure (as it was an application level user being authenticated and not the actual user).

The logins our application uses are actual database logins so while we store the user login id in a table we don't store the passwords.

I've just started to look at extending that validate against the database code - but want it to just try connecting to the database with the details and if it passes then return ok otherwise fail the authentication. ie I don't want to build up a cached list of users.



Was wondering if anyone has done this before I start to dig further into this (as I'm not a .NET developer so it is a little foreign to me)



Cheers

Rob
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.