001    /**
002     * Copyright (c) 2000-2013 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.security.auth;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    import java.util.Set;
020    
021    /**
022     * @author Tomas Polesovsky
023     * @author Raymond Aug??
024     */
025    public class AuthTokenWhitelistUtil {
026    
027            public static AuthTokenWhitelist getAuthTokenWhitelist() {
028                    PortalRuntimePermission.checkGetBeanProperty(AuthTokenWhitelist.class);
029    
030                    return _authTokenWhitelist;
031            }
032    
033            public static Set<String> getPortletCSRFWhitelist() {
034                    return getAuthTokenWhitelist().getPortletCSRFWhitelist();
035            }
036    
037            public static Set<String> getPortletCSRFWhitelistActions() {
038                    return getAuthTokenWhitelist().getPortletCSRFWhitelistActions();
039            }
040    
041            public static Set<String> getPortletInvocationWhitelist() {
042                    return getAuthTokenWhitelist().getPortletInvocationWhitelist();
043            }
044    
045            public static Set<String> getPortletInvocationWhitelistActions() {
046                    return getAuthTokenWhitelist().getPortletInvocationWhitelistActions();
047            }
048    
049            public static boolean isPortletCSRFWhitelisted(
050                    long companyId, String portletId, String strutsAction) {
051    
052                    return getAuthTokenWhitelist().isPortletCSRFWhitelisted(
053                            companyId, portletId, strutsAction);
054            }
055    
056            public static boolean isPortletInvocationWhitelisted(
057                    long companyId, String portletId, String strutsAction) {
058    
059                    return getAuthTokenWhitelist().isPortletInvocationWhitelisted(
060                            companyId, portletId, strutsAction);
061            }
062    
063            public static Set<String> resetPortletCSRFWhitelist() {
064                    return getAuthTokenWhitelist().resetPortletCSRFWhitelist();
065            }
066    
067            public static Set<String> resetPortletCSRFWhitelistActions() {
068                    return getAuthTokenWhitelist().resetPortletCSRFWhitelistActions();
069            }
070    
071            public static Set<String> resetPortletInvocationWhitelist() {
072                    return getAuthTokenWhitelist().resetPortletInvocationWhitelist();
073            }
074    
075            public static Set<String> resetPortletInvocationWhitelistActions() {
076                    return getAuthTokenWhitelist().resetPortletInvocationWhitelistActions();
077            }
078    
079            public void setAuthTokenWhitelist(AuthTokenWhitelist authTokenWhitelist) {
080                    PortalRuntimePermission.checkSetBeanProperty(getClass());
081    
082                    _authTokenWhitelist = authTokenWhitelist;
083            }
084    
085            private static AuthTokenWhitelist _authTokenWhitelist;
086    
087    }