/************************************************
 * Copyright (c) Shen Li. All rights reserved.  *
 * http://joyaop.sourceforge.net                *
 * -------------------------------------------- *
 * Distributable under LGPL license.            *
 * See terms of license at gnu.org.             *
 ************************************************/
package net.sf.joyaop.demo.rbac;

import net.sf.joyaop.AbstractInterceptor;

/**
 * @author Shen Li
 */
public abstract class AuthenticationInterceptor implements AbstractInterceptor {
    private AuthenticationManager authenticationManager;

    protected AuthenticationInterceptor(AuthenticationManager authenticationManager) {
        this.authenticationManager = authenticationManager;
    }

    public Object execute() throws Throwable {
        authenticationManager.authenticate(getPermissionName());
        return proceed();
    }

    protected abstract String getPermissionName();
}
