Friday 15 May 2015

Java Api Login Issue -


I am creating an API to allow end users to update my database. I am going to give API code a jar file I will put in and junk the user.

However I want the user to be authorized. (Give username and password)

Once the user has provided the username and password, should I check that the user is logging in every API call user? (I mean if the user is logged in or check in the hitter and setter)?

Is he a different way? Can check whether the user login credentials are correct or not? If not then the object has been deleted?

EDIT

The API will be in the jar file

  import package org.atul.module.registration; Public category hello () {private bool isLogin = false; Private string username = "user"; Private string password = "password"; Public Hallowld (String Username, String Password) {isLogin = checkAuthentication (username, password); // will be correct if the step is correct) Public string getInformation () {// return information from database} // other getters and setters   

as I do not stop the user from making an object Can I check logon is correct in every function (Gayter and Setter)?

I will give you a solution, maybe not the best but help you The intention is that you can only create objects with factories, so you have to ask and pass the user if you want you to be logged in, to check that you have logged in users in Superfast Can cache. I have made you a simple diagram

To create an object with a factory, register the user, throws exceptions, if there are no more users in the interface. In the interface, you declare the methods that you want Want to use. Manufacturers' use level is a package for classrooms, so your customers can not reach them with factories only.

solution

One more thing you can implement It's like a interceptor , every request the customer gives you, passes a class that checks whether the user is logged in or not.

No comments:

Post a Comment