Expand my Community achievements bar.

SOLVED

TokenUtil.createCredentials(..) replacement in 6.1 - programmatically login within a servlet?

Avatar

Level 1

Hi everyone!

We have an application that authenticates users against an independent service (front end); once users have been authenticated we direct them to a portion of the site that is protected via CUG, that means we have groups of users that are tied to a single AEM account.

In AEM 5.6.1 we were able to accomplish this by using the code below:

AuthenticationInfo authInfo = TokenUtil.createCredentials(request, response, repository, [AEM User ID], true);

Now that loginAdministrative(null) has been deprecated, this function no longer allows us to create a valid session with AEM.

Is there a replacement for the TokenUtil.createCredentials(...).

On the FrontEnd side we have no knowledge of the AEM user name / password so following the route of creating a custom authentication handler may not be a suitable solution. From what I've seen most authentication code depends on request parameter /attributes. In our case we identify the appropriate AEM user on a servlet based on its category once it's been authenticated with the remote service.

 is there a way to create the authentication info (session / token) from a servlet that is not an authentication handler?

 

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If you are checking the credentials after the login authentication, why were you using loginAdministrative(null) ?? You should get the session from the logged in User.

I am not sure, if I understand your usecase. Can you please explain in detail ?

However, loginAdministrative(null) but not TokenUtil.createCredentials().

View solution in original post

2 Replies

Avatar

Level 9

Hi there,

I don't think this API is deprecated. Here is the doc of the API.

https://docs.adobe.com/docs/en/aem/6-1/ref/javadoc/

By the way, What is your AEM version?.

--Jitendra

Avatar

Correct answer by
Level 10

Hi,

If you are checking the credentials after the login authentication, why were you using loginAdministrative(null) ?? You should get the session from the logged in User.

I am not sure, if I understand your usecase. Can you please explain in detail ?

However, loginAdministrative(null) but not TokenUtil.createCredentials().