@@ -0,0 +1,2234 @@
+/*%0A  Copyright 2012 - 2015 pac4j organization%0A%0A   Licensed under the Apache License, Version 2.0 (the %22License%22);%0A   you may not use this file except in compliance with the License.%0A   You may obtain a copy of the License at%0A%0A       http://www.apache.org/licenses/LICENSE-2.0%0A%0A   Unless required by applicable law or agreed to in writing, software%0A   distributed under the License is distributed on an %22AS IS%22 BASIS,%0A   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A   See the License for the specific language governing permissions and%0A   limitations under the License.%0A */%0Apackage org.pac4j.core.profile;%0A%0Aimport org.pac4j.core.authorization.Authorizer;%0Aimport org.pac4j.core.context.WebContext;%0A%0A/**%0A * %3Cp%3EThis abstract class is to be implemented in various implementation libraries,%0A * to manage the current user profile, i.e. the one of the current authenticated user.%3C/p%3E%0A * %3Cp%3EThe constructors of the subclasses will tell which inputs are required in the specific libraries.%3C/p%3E%0A *%0A * %0A * @author Jerome Leleu%0A * @since 1.8.0%0A */%0Apublic abstract class ProfileManager%3CC extends CommonProfile%3E %7B%0A%0A    /**%0A     * Retrieve the user profile.%0A     *%0A     * @return the user profile%0A     */%0A    public abstract C get();%0A%0A    /**%0A     * Remove the current user profile.%0A     */%0A    public abstract void remove();%0A%0A    /**%0A     * Save the given user profile as the current one.%0A     *%0A     * @param profile a given user profile%0A     */%0A    public abstract void save(final C profile);%0A%0A    /**%0A     * Perform a logout by removing the current user profile.%0A     */%0A    public void logout() %7B%0A        remove();%0A    %7D%0A%0A    /**%0A     * Tests if the current is authenticated (meaning a user profile exists).%0A     *%0A     * @return whether the current user is authenticated%0A     */%0A    public boolean isAuthenticated() %7B%0A        return get() != null;%0A    %7D%0A%0A    /**%0A     * Tests whether the current user is authorized.%0A     *%0A     * @param context the web context%0A     * @param authorizer a given authorizer%0A     * @return whether the user is authorized%0A     */%0A    public boolean isAuthorized(final WebContext context, final Authorizer%3CC%3E authorizer) %7B%0A        return authorizer.isAuthorized(context, get());%0A    %7D%0A%7D%0A

add ProfileManager