Example usage for com.liferay.portal.kernel.util PropsKeys TUNNELING_SERVLET_SHARED_SECRET

List of usage examples for com.liferay.portal.kernel.util PropsKeys TUNNELING_SERVLET_SHARED_SECRET

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys TUNNELING_SERVLET_SHARED_SECRET.

Prototype

String TUNNELING_SERVLET_SHARED_SECRET

To view the source code for com.liferay.portal.kernel.util PropsKeys TUNNELING_SERVLET_SHARED_SECRET.

Click Source Link

Usage

From source file:org.kmworks.portal.rpc.Configuration.java

License:Open Source License

private static boolean initialize(HttpPrincipal principal, String secret, int waitForServerStartupTimeoutSec) {
    // set shared secret first!
    sharedSecret = secret;/*from  w w  w  .  j  ava  2s  . c om*/
    PropsUtil.set(PropsKeys.TUNNELING_SERVLET_SHARED_SECRET, sharedSecret);
    // create the authetication token
    authToken = new AuthToken(principal);
    // try to retrieve associated user id
    long userId = getUserIdWaitFor(authToken, waitForServerStartupTimeoutSec);
    // setup PrincipalThreadLocal to satisfy Liferay model classes
    if (userId != 0L) {
        PrincipalThreadLocal.setName(userId);
        PrincipalThreadLocal.setPassword(principal.getPassword());
        return true;
    } else {
        return false;
    }
}