<commit_before>#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/security
                           http://www.springframework.org/schema/security/spring-security.xsd">

    <!-- Enables Method Security and Expression-based access control -->
    <security:global-method-security pre-post-annotations="enabled">
        <!-- Enables custom expression handler -->
        <security:expression-handler ref="methodExpressionHandler" />
    </security:global-method-security>

    <!-- bcrypt password encoder -->
    <bean id="bcryptEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder">
        <!-- Configure the strength (log rounds). Default = 10 -->
        <constructor-arg value="10"/>
    </bean>

    <!-- Custom Authentication Provider -->
    <bean id="shogun2AuthenticationProvider" class="de.terrestris.shogun2.security.Shogun2AuthenticationProvider">
        <property name="passwordEncoder" ref="bcryptEncoder" />
    </bean>

    <security:authentication-manager alias="authenticationManager" >
        <security:authentication-provider ref="shogun2AuthenticationProvider" />
    </security:authentication-manager>

    <!-- Web/URL security -->
    <security:http auto-config="true" use-expressions="true" access-decision-manager-ref="accessDecisionManager">
        <security:intercept-url pattern="/**" access="hasRole('ROLE_USER')" />

        <!-- As CSRF protection is enabled by default in Spring Security 4,
             the logout-url will only work with POST requests. To work with
             GET requests CSRF has to be disabled -->
        <!-- <security:csrf disabled="true"/> -->
        <security:logout logout-url="/logout" />
    </security:http>

    <!-- This bean is referenced by the http security config to assure that the role hierarchy will be used -->
    <bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
        <constructor-arg>
            <bean id="webExpressionVoter" class="org.springframework.security.web.access.expression.WebExpressionVoter">
                <property name = "expressionHandler">
                    <bean id="webExpressionHandler" class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler">
                        <property name = "roleHierarchy" ref="roleHierarchy" />
                    </bean>
                </property>
            </bean>
        </constructor-arg>
    </bean>

    <!-- See http://goo.gl/o42k1S -->
    <bean id="methodExpressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
    <!-- To use hasPermission() in expressions, configure a PermissionEvaluator -->
         <property name = "permissionEvaluator" ref="permissionEvaluator" />
         <property name = "roleHierarchy" ref="roleHierarchy"/>
    </bean>

    <!-- http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/access/hierarchicalroles/RoleHierarchyImpl.html -->
    <bean id="roleHierarchy"  class="org.springframework.security.access.hierarchicalroles.RoleHierarchyImpl">
        <property name="hierarchy">
            <value>
                ROLE_ADMIN > ROLE_USER
            </value>
        </property>
    </bean>

</beans><commit_msg>Change default security namespace<commit_after>#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
       xmlns:beans="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/security
                           http://www.springframework.org/schema/security/spring-security.xsd">

    <!-- Enables Method Security and Expression-based access control -->
    <global-method-security pre-post-annotations="enabled">
        <!-- Enables custom expression handler -->
        <expression-handler ref="methodExpressionHandler" />
    </global-method-security>

    <!-- bcrypt password encoder -->
    <beans:bean id="bcryptEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder">
        <!-- Configure the strength (log rounds). Default = 10 -->
        <beans:constructor-arg value="10"/>
    </beans:bean>

    <!-- Custom Authentication Provider -->
    <beans:bean id="shogun2AuthenticationProvider" class="de.terrestris.shogun2.security.Shogun2AuthenticationProvider">
        <beans:property name="passwordEncoder" ref="bcryptEncoder" />
    </beans:bean>

    <authentication-manager alias="authenticationManager" >
        <authentication-provider ref="shogun2AuthenticationProvider" />
    </authentication-manager>

    <!-- Web/URL security -->
    <http auto-config="true" use-expressions="true" access-decision-manager-ref="accessDecisionManager">
        <intercept-url pattern="/**" access="hasRole('ROLE_USER')" />

        <!-- As CSRF protection is enabled by default in Spring Security 4,
             the logout-url will only work with POST requests. To work with
             GET requests CSRF has to be disabled -->
        <!-- <csrf disabled="true"/> -->
        <logout logout-url="/logout" />
    </http>

    <!-- This bean is referenced by the http security config to assure that the role hierarchy will be used -->
    <beans:bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
        <beans:constructor-arg>
            <beans:bean id="webExpressionVoter" class="org.springframework.security.web.access.expression.WebExpressionVoter">
                <beans:property name = "expressionHandler">
                    <beans:bean id="webExpressionHandler" class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler">
                        <beans:property name = "roleHierarchy" ref="roleHierarchy" />
                    </beans:bean>
                </beans:property>
            </beans:bean>
        </beans:constructor-arg>
    </beans:bean>

    <!-- See http://goo.gl/o42k1S -->
    <beans:bean id="methodExpressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
    <!-- To use hasPermission() in expressions, configure a PermissionEvaluator -->
         <beans:property name = "permissionEvaluator" ref="permissionEvaluator" />
         <beans:property name = "roleHierarchy" ref="roleHierarchy"/>
    </beans:bean>

    <!-- http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/access/hierarchicalroles/RoleHierarchyImpl.html -->
    <beans:bean id="roleHierarchy"  class="org.springframework.security.access.hierarchicalroles.RoleHierarchyImpl">
        <beans:property name="hierarchy">
            <beans:value>
                ROLE_ADMIN > ROLE_USER
            </beans:value>
        </beans:property>
    </beans:bean>

</beans:beans>
{'fraction_non_alphanumeric': 0.13716356107660455, 'fraction_numerical': 0.005693581780538302, 'mean_word_length': 2.9963805584281284, 'pattern_counts': {'":': 0, '<': 109, '<?xml version=': 2, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 14, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6895536', 'n_tokens_mistral': 2111, 'n_tokens_neox': 2036, 'n_words': 366}