Spring Security with Backbone URLs

A.Onur Özcan

I have a single page application and i want to use spring security. In spring-security.xml file, i must give a url to prevent a user.

For example:

<security:intercept-url pattern="/#cities" access="isAuthenticated"/>

After this configuration when i try to enter without authentication

"localhost:8082/project_name/#cities" 

It isn't preventing me. I can access the page.

I think, it happens because of that the URL is not real URL. There is only one page. (index.html)

How can i solve this problem? I am sorry about my bad english. Thank You!

billjamesdev

You cannot secure Routes on the back end, as nothing after the # sign in a URL is ever sent up to the server. You can secure PAGES and ajax endpoints, but you can't secure Routes (the thing after the hash #).

In your sample url there, you can only secure the /project_name part of the URL. If you don't want people to access the /project_name/#cities, then you'll need to make that a different page.

If you want to secure the #cities views, you'll need to either stop that module from rendering to the client (make sure the .js file that contains the #cities code doesn't get sent down), or you could make it so the #cities views have to retrieve data and secure the ajax endpoints instead.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

AspectJ with Spring Security

분류에서Dev

Spring security not authenticate the user

분류에서Dev

Spring Security two authenticationSuccessHandler

분류에서Dev

Spring Security Active Directory

분류에서Dev

spring filters applies to all api urls Errors

분류에서Dev

xmlBeanDefinitionStoreException while implementing spring security

분류에서Dev

Spring Security @preauthorize 우회

분류에서Dev

Confusion in Spring Security Filter Chain

분류에서Dev

spring security 3.2 java configuration

분류에서Dev

Person and Group with authority on Spring security

분류에서Dev

Spring security_Password Encryption

분류에서Dev

Recover username and password with spring security

분류에서Dev

Spring security session time out

분류에서Dev

Spring MVC + Security with Java Configuration

분류에서Dev

Spring mvc and spring security version conflict

분류에서Dev

Spring MVC와 Backbone jQuery Template 충돌

분류에서Dev

Spring Security - 'global-method-security' does not work

분류에서Dev

Spring Framework 4.0 및 Spring Security 3.2.4의 Spring Security SAML 확장

분류에서Dev

Spring Security 302 리디렉션

분류에서Dev

Spring Security 인증 로직

분류에서Dev

Download secure page from controller, Spring security

분류에서Dev

how to bypass spring security login check in grails

분류에서Dev

JSF Managed Beans not working with spring security filter

분류에서Dev

Spring Security로 REST API 보안

분류에서Dev

Spring Security에서 PasswordEncoder 사용

분류에서Dev

The page isn't redirecting properly spring security

분류에서Dev

Spring Security로 REST 보안

분류에서Dev

Spring Security의 체인 인증

분류에서Dev

How to secure an included page with Spring security