001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.security.access.control;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.security.auth.verifier.AuthVerifierResult;
019    import com.liferay.portal.security.auth.AuthException;
020    
021    import java.lang.annotation.Annotation;
022    
023    import java.util.Map;
024    
025    import javax.servlet.http.HttpServletRequest;
026    import javax.servlet.http.HttpServletResponse;
027    
028    /**
029     * @author Raymond Aug??
030     */
031    public interface AccessControl {
032    
033            public void initAccessControlContext(
034                    HttpServletRequest request, HttpServletResponse response,
035                    Map<String, Object> settings);
036    
037            public void initContextUser(long userId) throws AuthException;
038    
039            public AuthVerifierResult.State verifyRequest() throws PortalException;
040    
041            public AccessControlled NULL_ACCESS_CONTROLLED = new AccessControlled() {
042    
043                    @Override
044                    public Class<? extends Annotation> annotationType() {
045                            return AccessControlled.class;
046                    }
047    
048                    @Override
049                    public boolean guestAccessEnabled() {
050                            return false;
051                    }
052    
053                    @Override
054                    public boolean hostAllowedValidationEnabled() {
055                            return false;
056                    }
057    
058            };
059    
060    }