Skip to content

Commit

Permalink
play FB authent for roleadmin url
Browse files Browse the repository at this point in the history
  • Loading branch information
leleuj committed Aug 12, 2016
1 parent 17caceb commit b7db4c0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -10,6 +10,6 @@ This `spring-security-pac4j-demo` project is a Spring Security web application t
Build the project and launch the web app with jetty on [http://localhost:8080](http://localhost:8080):

cd spring-security-pac4j-demo
mvn clean compile jetty:run
mvn clean package jetty:run

To test, you can call a protected url by clicking on the "Protected url by **xxx**" link, which will start the authentication process with the **xxx** provider.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -22,7 +22,7 @@

<properties>
<java.version>1.8</java.version>
<springSecurityPac4jVersion>2.0.0</springSecurityPac4jVersion>
<springSecurityPac4jVersion>2.0.1-SNAPSHOT</springSecurityPac4jVersion>
<pac4jVersion>1.9.1</pac4jVersion>
<springSecurityVersion>4.1.0.RELEASE</springSecurityVersion>
<springVersion>4.3.1.RELEASE</springVersion>
Expand Down
14 changes: 13 additions & 1 deletion src/main/resources/securityContext.xml
Expand Up @@ -8,7 +8,10 @@
http://www.springframework.org/schema/security/spring-security-4.1.xsd">

<security:authentication-manager />
<bean id="pac4jEntryPoint" class="org.pac4j.springframework.security.web.Pac4jEntryPoint" />
<bean id="pac4jEntryPoint" class="org.pac4j.springframework.security.web.Pac4jEntryPoint">
<!--property name="config" ref="config" />
<property name="clientName" value="FacebookClient" /-->
</bean>


<bean id="facebookSecurityFilter" class="org.pac4j.springframework.security.web.SecurityFilter">
Expand Down Expand Up @@ -148,6 +151,15 @@
</security:http>


<bean id="roleAdminSecurityFilter" class="org.pac4j.springframework.security.web.SecurityFilter">
<property name="config" ref="config" />
<property name="clients" value="FacebookClient" />
</bean>
<security:http create-session="always" pattern="/roleadmin/**" entry-point-ref="pac4jEntryPoint">
<security:custom-filter position="BASIC_AUTH_FILTER" ref="roleAdminSecurityFilter" />
</security:http>


<security:http pattern="/**" entry-point-ref="pac4jEntryPoint">
<security:csrf disabled="true"/>
<security:headers disabled="true" />
Expand Down

0 comments on commit b7db4c0

Please sign in to comment.