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

com.github.lontime.extpac4j.provider.Provider Maven / Gradle / Ivy

The newest version!
package com.github.lontime.extpac4j.provider;

import java.io.Closeable;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.github.lontime.base.commonj.components.ComponentLifecycle;
import org.pac4j.core.context.JEEContext;
import org.pac4j.core.context.WebContextFactory;
import org.pac4j.core.context.session.SessionStore;
import org.pac4j.core.engine.CallbackLogic;
import org.pac4j.core.engine.LogoutLogic;
import org.pac4j.core.engine.SecurityGrantedAccessAdapter;
import org.pac4j.core.engine.SecurityLogic;
import org.pac4j.core.http.adapter.HttpActionAdapter;
import org.pac4j.core.profile.UserProfile;
import org.pac4j.core.profile.factory.ProfileManagerFactory;

/**
 * Provider.
 *
 * @author lontime
 * @since 1.0
 */
public interface Provider extends ComponentLifecycle, Closeable {

    /**
     * security.
     *
     * @param  R
     * @param request  request
     * @param response response
     * @param accessAdapter accessAdapter
     * @return true/false
     */
    default  R security(HttpServletRequest request, HttpServletResponse response,
                           SecurityGrantedAccessAdapter accessAdapter) {
        return security(request, response, accessAdapter, null);
    }

    /**
     * security.
     *
     * @param  R
     * @param request      request
     * @param response     response
     * @param accessAdapter accessAdapter
     * @param localAdapter localAdapter
     * @return true/false
     */
    default  R security(HttpServletRequest request, HttpServletResponse response,
                           SecurityGrantedAccessAdapter accessAdapter,
                             HttpActionAdapter localAdapter) {
        return security(request, response, accessAdapter, localAdapter, null, null);
    }

    /**
     * security.
     *
     * @param  R
     * @param request           request
     * @param response          response
     * @param accessAdapter accessAdapter
     * @param localAdapter      localAdapter
     * @param localSessionStore localSessionStore
     * @return true/false
     */
    default  R security(HttpServletRequest request, HttpServletResponse response,
                             SecurityGrantedAccessAdapter accessAdapter,
                             HttpActionAdapter localAdapter,
                             SessionStore localSessionStore) {
        return security(request, response, accessAdapter, localAdapter, localSessionStore, null);
    }

    /**
     * security.
     *
     * @param  R
     * @param request           request
     * @param response          response
     * @param accessAdapter accessAdapter
     * @param accessAdapter accessAdapter
     * @param localAdapter      localAdapter
     * @param localSessionStore localSessionStore
     * @param localContextFactory localContextFactory
     * @return true/false
     */
    default  R security(HttpServletRequest request, HttpServletResponse response,
                             SecurityGrantedAccessAdapter accessAdapter,
                             HttpActionAdapter localAdapter,
                             SessionStore localSessionStore,
                             WebContextFactory localContextFactory) {
        return security(request, response, accessAdapter, localAdapter, localSessionStore,
                localContextFactory, null);
    }

    /**
     * security.
     *
     * @param  R
     * @param request             request
     * @param response            response
     * @param accessAdapter accessAdapter
     * @param localAdapter        localAdapter
     * @param localSessionStore   localSessionStore
     * @param localContextFactory localContextFactory
     * @param localSecurityLogic  localSecurityLogic
     * @return true/false
     */
     R security(HttpServletRequest request, HttpServletResponse response,
                     SecurityGrantedAccessAdapter accessAdapter,
                        HttpActionAdapter localAdapter,
                        SessionStore localSessionStore,
                        WebContextFactory localContextFactory,
                        SecurityLogic localSecurityLogic);

    /**
     * callback.
     */
    default void logout() {
        callback(null);
    }

    /**
     * callback.
     *
     * @param localAdapter adapter
     */
    default void logout(HttpActionAdapter localAdapter) {
        logout(localAdapter, null, null);
    }

    /**
     * callback.
     *
     * @param localAdapter        adapter
     * @param localSessionStore   localSessionStore
     * @param localContextFactory localContextFactory
     */
    default void logout(HttpActionAdapter localAdapter,
                        SessionStore localSessionStore,
                        WebContextFactory localContextFactory) {
        logout(localAdapter, localSessionStore, localContextFactory, null);
    }

    /**
     * callback.
     *
     * @param localAdapter      adapter
     * @param localSessionStore localSessionStore
     * @param localLogoutLogic  localLogoutLogic
     * @param localContextFactory localContextFactory
     */
    void logout(HttpActionAdapter localAdapter,
                SessionStore localSessionStore,
                WebContextFactory localContextFactory,
                LogoutLogic localLogoutLogic);

    /**
     * logout.
     *
     * @param request  request
     * @param response response
     */
    default void logout(final HttpServletRequest request, final HttpServletResponse response) {
        logout(request, response, null);
    }

    /**
     * logout.
     *
     * @param request      request
     * @param response     response
     * @param localAdapter localAdapter
     */
    default void logout(final HttpServletRequest request, final HttpServletResponse response,
                        HttpActionAdapter localAdapter) {
        logout(request, response, localAdapter, null, null);
    }

    /**
     * logout.
     *
     * @param request           request
     * @param response          response
     * @param localAdapter      localAdapter
     * @param localSessionStore localSessionStore
     */
    default void logout(final HttpServletRequest request, final HttpServletResponse response,
                        HttpActionAdapter localAdapter,
                        SessionStore localSessionStore) {
        logout(request, response, localAdapter, localSessionStore, null);
    }

    /**
     * logout.
     *
     * @param request             request
     * @param response            response
     * @param localAdapter        localAdapter
     * @param localSessionStore   localSessionStore
     * @param localContextFactory localContextFactory
     */
    default void logout(final HttpServletRequest request, final HttpServletResponse response,
                        HttpActionAdapter localAdapter,
                        SessionStore localSessionStore,
                        WebContextFactory localContextFactory) {
        logout(request, response, localAdapter, localSessionStore, localContextFactory, null);
    }

    /**
     * logout.
     *
     * @param request             request
     * @param response            response
     * @param localAdapter        localAdapter
     * @param localSessionStore   localSessionStore
     * @param localContextFactory localContextFactory
     * @param localLogoutLogic    localLogoutLogic
     */
    void logout(final HttpServletRequest request, final HttpServletResponse response,
                HttpActionAdapter localAdapter,
                SessionStore localSessionStore,
                WebContextFactory localContextFactory,
                LogoutLogic localLogoutLogic);

    /**
     * callback.
     */
    default void callback() {
        callback(null);
    }

    /**
     * callback.
     *
     * @param localAdapter adapter
     */
    default void callback(HttpActionAdapter localAdapter) {
        callback(localAdapter, null, null);
    }

    /**
     * callback.
     *
     * @param localAdapter        adapter
     * @param localSessionStore   localSessionStore
     * @param localContextFactory localContextFactory
     */
    default void callback(HttpActionAdapter localAdapter,
                          SessionStore localSessionStore,
                          WebContextFactory localContextFactory) {
        callback(localAdapter, localSessionStore, localContextFactory, null);
    }

    /**
     * callback.
     *
     * @param localAdapter       adapter
     * @param localSessionStore  localSessionStore
     * @param localCallbackLogic localCallbackLogic
     * @param localContextFactory localContextFactory
     */
    void callback(HttpActionAdapter localAdapter,
                  SessionStore localSessionStore,
                  WebContextFactory localContextFactory,
                  CallbackLogic localCallbackLogic);

    /**
     * callback.
     *
     * @param request  request
     * @param response response
     */
    default void callback(final HttpServletRequest request, final HttpServletResponse response) {
        callback(request, response, null);
    }

    /**
     * callback.
     *
     * @param request      request
     * @param response     response
     * @param localAdapter adapter
     */
    default void callback(final HttpServletRequest request, final HttpServletResponse response,
                          HttpActionAdapter localAdapter) {
        callback(request, response, localAdapter, null, null);
    }

    /**
     * callback.
     *
     * @param request             request
     * @param response            response
     * @param localAdapter        adapter
     * @param localSessionStore   localSessionStore
     * @param localContextFactory localContextFactory
     */
    default void callback(final HttpServletRequest request, final HttpServletResponse response,
                          HttpActionAdapter localAdapter,
                          SessionStore localSessionStore,
                          WebContextFactory localContextFactory) {
        callback(request, response, localAdapter, localSessionStore, localContextFactory, null);
    }

    /**
     * callback.
     *
     * @param request             request
     * @param response            response
     * @param localAdapter        adapter
     * @param localSessionStore   localSessionStore
     * @param localCallbackLogic  localCallbackLogic
     * @param localContextFactory localContextFactory
     */
    void callback(final HttpServletRequest request, final HttpServletResponse response,
                  HttpActionAdapter localAdapter,
                  SessionStore localSessionStore,
                  WebContextFactory localContextFactory,
                  CallbackLogic localCallbackLogic);

    /**
     * getUserProfiles.
     *
     * @return list
     */
    default List getUserProfiles() {
        return getUserProfiles(null);
    }

    /**
     * getUserProfiles.
     *
     * @param localSessionStore localSessionStore
     * @return list
     */
    default List getUserProfiles(SessionStore localSessionStore) {
        return getUserProfiles(localSessionStore, null);
    }

    /**
     * getUserProfiles.
     *
     * @param localSessionStore          localSessionStore
     * @param localContextFactory localContextFactory
     * @return list
     */
    default List getUserProfiles(SessionStore localSessionStore,
                                      WebContextFactory localContextFactory) {
        return getUserProfiles(localSessionStore, localContextFactory, null);
    }

    /**
     * getUserProfiles.
     *
     * @param localSessionStore          localSessionStore
     * @param localProfileManagerFactory localProfileManagerFactory
     * @param localContextFactory localContextFactory
     * @return list
     */
    List getUserProfiles(SessionStore localSessionStore,
                                      WebContextFactory localContextFactory,
                                      ProfileManagerFactory localProfileManagerFactory);

    /**
     * getUserProfiles.
     *
     * @param request  request
     * @param response response
     * @return list
     */
    default List getUserProfiles(final HttpServletRequest request,
                                              final HttpServletResponse response) {
        return getUserProfiles(request, response, null);
    }

    /**
     * getUserProfiles.
     *
     * @param request           request
     * @param response          response
     * @param localSessionStore localSessionStore
     * @return list
     */
    default List getUserProfiles(final HttpServletRequest request,
                                              final HttpServletResponse response,
                                              SessionStore localSessionStore) {
        return getUserProfiles(request, response, localSessionStore, null);
    }

    /**
     * getUserProfiles.
     *
     * @param request             request
     * @param response            response
     * @param localSessionStore   localSessionStore
     * @param localContextFactory localContextFactory
     * @return list
     */
    default List getUserProfiles(final HttpServletRequest request,
                                              final HttpServletResponse response,
                                              SessionStore localSessionStore,
                                              WebContextFactory localContextFactory) {
        return getUserProfiles(request, response, localSessionStore, localContextFactory, null);
    }

    /**
     * getUserProfiles.
     *
     * @param request                    request
     * @param response                   response
     * @param localSessionStore          localSessionStore
     * @param localProfileManagerFactory localProfileManagerFactory
     * @param localContextFactory        localContextFactory
     * @return list
     */
    List getUserProfiles(final HttpServletRequest request,
                                      final HttpServletResponse response,
                                      SessionStore localSessionStore,
                                      WebContextFactory localContextFactory,
                                      ProfileManagerFactory localProfileManagerFactory);

    /**
     * close.
     */
    @Override
    void close();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy