0
나는 안드로이드 애플 리케이션과 함께 Symfony2 애플 리케이션이 배포 서버에 인증하려고합니다. 심포니의 보안 시스템은 표준 :Symfony2에 안드로이드 애플 리케이션의 인증이 통과되지 않습니다
secured_mobile:
pattern: ^/mobile
form_login:
login_path: mobile_login
check_path: mobile_login_check
양식 Andoid 애플 리케이션은 내가 요청합니다
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpPost = new HttpGet("http://server/app_dev.php/mobile/login_check");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("_username", "user"));
nameValuePairs.add(new BasicNameValuePair("_password", "userpass"));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse httpResponse = httpclient.execute(httpPost);
을 그리고 페이지 (mobile_login)를 로그인 리디렉션.
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://server/app_dev.php/mobile/login_check?_username=user&_password=userpass");
HttpResponse httpResponse = httpclient.execute(httpPost);
을하지만 브라우저에 넣어 동일한 URL이 작동하지만, (mobile_login로 리디렉션) 통과하지 않습니다
이 난 얻을 요청에 의해 lodded 얻을려고!
http://server/app_dev.php/mobile/login_check?_username=user&_password=userpass
누구나 Symfony가 필요로하는 것을 알고 있습니까?
security.yml
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
ROLE_MANAGER: ROLE_USER
ROLE_ADMIN: ROLE_MANAGER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
firewalls:
secured_mobile:
pattern: ^/mobile
anonymous: ~
form_login:
post_only: false
login_path: /mobile/login
check_path: /mobile/login_check
default_target_path: /mobile/login_ok
always_use_default_target_path: true
access_control:
- { path: ^/mobile/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY}
- { path: ^/mobile/, roles: ROLE_USER }
더 security.yml : [GET, POST]'전' form_login' configuration – Trone
는'방법을 추가 할 수 security.yml – VladRia
시도를 추가하십시오 – Trone