All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xillium.gear.auth.PageAwareAuthenticator Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
package org.xillium.gear.auth;

import org.xillium.data.DataBinder;
import org.xillium.core.Service;


/**
 * An Authenticator that supports page redirection.
 */
public abstract class PageAwareAuthenticator implements Authenticator {
    private String _page;

    /**
     * Configures an authentication page.
     */
    public void setAuthenticationPage(String page) {
        _page = page;
    }

    /*#
     * Redirects to the configured authentication page, passing the target service as parameter "_redirect_".
     */
    protected void redirectToAuthenticationPage(DataBinder binder) {
        if (_page != null) {
            binder.mul(Service.SERVICE_HTTP_HEADER, String.class, String.class).add("Content-Type", "text/html; charset=utf-8");
            binder.put(Service.SERVICE_PAGE_TARGET, _page + "?_redirect_=" + binder.get(Service.REQUEST_TARGET_PATH));
//_logger.log(Level.FINE, "redirecting to {0}", binder.get(Service.SERVICE_PAGE_TARGET));
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy