Does someone has an example Java code which creates a new session for an account ?

0
Hi guys   This question came a few times and there is also an extended blogpost about including autologin widget, that is really nice and coold. But I am looking just for an example Java code which on basis of the acocunt initiates a new session for that account. Imagine an Oauth implementation where you find the corresponding account, and you want to start a new session for the user  who is verified. Anyone an working Java action who can help save me and future folks a lot of time? thanks a lot
asked
2 answers
0

Have a look at Core.initializeSession on how to create a Session. If you do not have an IUser object yet you can fetch one using the Core.getUser Method.

answered
0

If you check out the OAuth module, the relevant code can be found in:

/javasource/oauthmodule/actions/custom/LoginHelper.java

which is called from around

/javasource/oauthmodule/actions/custom/OauthCallback.java line 281

Be aware that you should set cookie information (see LoginHelper.java) and that you can only do that in a request handler.

answered