How can we restrict usage of SWAGGER API to superuser role only?
Release Automation 6.x
<b:beans profile="basic"> <http auto-config="true" entry-point-ref="delegatingAuthenticationEntryPoint" realm="center-realm" disable-url-rewriting="true"> <intercept-url pattern="/apis/public.html" access="ROLE_SUPERUSER"/> <intercept-url pattern="/a/api/v3/upgrade-agents" access="ROLE_SUPERUSER"/> <intercept-url pattern="/login.jsp*" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <!--filters="none"--> <intercept-url pattern="/actionshelp.jsp*" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <!--filters="none"--> <intercept-url pattern="/actionshelpxml.jsp*" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <!--filters="none"--> <!-- <intercept-url pattern="/a/*" filters="none" /> <!–filters="none"–>--> <intercept-url pattern="/tail-process.jsp*" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/a/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/design/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/ra/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/websocket/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/asaprest/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/reporting/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/reports/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/monitoringui.html*" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/monitoringui.html" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/monitoringui/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/index.jsp*" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/index.jsp" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/index.html*" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/index.html" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <intercept-url pattern="/scripts/**" access="ROLE_LDAP,ROLE_SUPERUSER,ROLE_USER,ROLE_SYS_ADMIN,ROLE_USER_ADMIN" /> <form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?login_error=1" default-target-url="/" always-use-default-target="false" /> <anonymous /> <http-basic /> <csrf request-matcher-ref="csrfSessionRequestMatcher"/> <custom-filter after="BASIC_AUTH_FILTER" ref="runAsFilter" /> <custom-filter ref="masterNacIdentifierInterceptor" after="LAST"/> <!--<logout logout-success-url="/login.jsp" logout-url="/logout.jsp" invalidate-session="true"/>--> <logout logout-success-url="/login.jsp" invalidate-session="true"/> <custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" /> <session-management session-authentication-strategy-ref="sas"> <!--<concurrency-control max-sessions="1" error-if-maximum-exceeded="true" />--> </session-management> </http>
Above configuration will restrict access to SWAGGER page as a whole and to upgrade-agents API in particular for any role other than superuser with basic profile. For SAML profile please add appropriate configuration in same file under SAML section.