[keycloak-user] Programmatically login as a user

valsaraj pv valsarajpv at gmail.com
Fri Jun 1 05:53:56 EDT 2018


 Thanks!
Would you share more details? Any link will be helpful

.

On Fri, Jun 1, 2018 at 3:16 PM, Tony Harris <Tony.Harris at oneadvanced.com>
wrote:

> Why not look at a confidential client and login using the client id and
> client secret
>
> -----Original Message-----
> From: keycloak-user-bounces at lists.jboss.org [mailto:keycloak-user-bounces@
> lists.jboss.org] On Behalf Of valsaraj pv
> Sent: 01 June 2018 10:13
> To: keycloak-user <keycloak-user at lists.jboss.org>
> Subject: Re: [keycloak-user] Programmatically login as a user
>
> I tried following code:
>
> > loginContext = new LoginContext("keycloak", new CallbackHandler() {
> >      @Override
> > public void handle(Callback[] callbacks) { int len = callbacks.length;
> > Callback cb; for (int i = 0; i < len; i++) {
> >      cb = callbacks[i];
> >      if (cb instanceof NameCallback) { NameCallback ncb =
> > (NameCallback) cb; ncb.setName(mdbuserName);
> >      } else if (cb instanceof PasswordCallback) { PasswordCallback pcb
> > = (PasswordCallback) cb; pcb.setPassword(mdbUsrPass);
> >      }
> > }
> >      }
> >  });
> >  loginContext.login();
>
>
> For following dependency issue while trying to login:
>
> > *[Server:app-node-00] unable to find LoginModule class:
> > org.keycloak.adapters.jboss.KeycloakLoginModule from [Module
> > "deployment.app.ear.appEJB.jar:main" from Service Module Loader] at
> > javax.security.auth.login.LoginContext (line 794)*
>
>
>
> On Thu, May 31, 2018 at 6:11 PM, valsaraj pv <valsarajpv at gmail.com> wrote:
>
> >
> > Hi,
> >
> > I have web application login via Keycloak working fine. But for a
> > background processing like reading messages from a queue, need to
> > login as a dedicated queue user behind the scenes. For this we can't
> > redirect to login page. Earlier it was done pro grammatically  by
> > using JAAS login context and passing login module & credentials. Now
> > when we switch to KC, what is the appropriate model to do this?
> > Please advice!
> >
> > Thanks!
> >
>
>
>
> --
> Life is like this: "Just when we get all the answers of life.... God
> changes the question paper....
>
> Valsaraj Viswanathan
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
> ________________________________
>
> Please consider the environment: Think before you print!
>
>
> This message has been scanned for malware by Websense. www.websense.com
>



-- 
Life is like this: "Just when we get all the answers of life.... God
changes the question paper....

Valsaraj Viswanathan


More information about the keycloak-user mailing list