1

I'm trying to find a way using a java code, so that I could provide it with url, username and password and the code automatically opens the link in a browser and login without me having to provide credentials again in the browser when the link opens. Is there a way to do that ?

1 Answers1

0

You can pass username and password through get parameters such as:

mysite.com/login?username=user&password=user

Then you can extract this parameters from request and use them for authentication:

@RequestMapping("login")
public String login(@RequestParam(required=false) String username, 
@RequestParam(required=false) String password) {
    if(username != null && password != null) { 
       //perform auth
    }
    return "login";
}

But better way would be to associate unique token with each user and login them based on that.

//P.S. For opening browser with specified url you can use: Open a link in browser with java button?

Community
  • 1
  • 1
phoenix455
  • 46
  • 6