diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-02-09 13:59:48 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-02-09 13:59:48 +0100 |
commit | 0ac38198ab1c00dfb290d5631fa7c1cf5ac2a48a (patch) | |
tree | 29f468b3fc503fea223a471539959ccd80840c57 | |
parent | 89c03230c3d51e618608b044b0e3f45cf0c06a11 (diff) | |
download | wallabag-0ac38198ab1c00dfb290d5631fa7c1cf5ac2a48a.tar.gz wallabag-0ac38198ab1c00dfb290d5631fa7c1cf5ac2a48a.tar.zst wallabag-0ac38198ab1c00dfb290d5631fa7c1cf5ac2a48a.zip |
authentication on API
-rw-r--r-- | app/config/security.yml | 8 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Security/Authentication/Provider/WsseProvider.php | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/config/security.yml b/app/config/security.yml index e161c3b5..4a798e56 100644 --- a/app/config/security.yml +++ b/app/config/security.yml | |||
@@ -16,9 +16,11 @@ security: | |||
16 | # the main part of the security, where you can set up firewalls | 16 | # the main part of the security, where you can set up firewalls |
17 | # for specific sections of your app | 17 | # for specific sections of your app |
18 | firewalls: | 18 | firewalls: |
19 | #wsse_secured: | 19 | wsse_secured: |
20 | # pattern: /api/.* | 20 | pattern: /api/.* |
21 | # wsse: true | 21 | wsse: true |
22 | stateless: true | ||
23 | anonymous: true | ||
22 | login_firewall: | 24 | login_firewall: |
23 | pattern: ^/login$ | 25 | pattern: ^/login$ |
24 | anonymous: ~ | 26 | anonymous: ~ |
diff --git a/src/Wallabag/CoreBundle/Security/Authentication/Provider/WsseProvider.php b/src/Wallabag/CoreBundle/Security/Authentication/Provider/WsseProvider.php index 5499f400..eaad9c63 100644 --- a/src/Wallabag/CoreBundle/Security/Authentication/Provider/WsseProvider.php +++ b/src/Wallabag/CoreBundle/Security/Authentication/Provider/WsseProvider.php | |||
@@ -44,6 +44,12 @@ class WsseProvider implements AuthenticationProviderInterface | |||
44 | if (file_exists($this->cacheDir.'/'.$nonce) && file_get_contents($this->cacheDir.'/'.$nonce) + 300 > time()) { | 44 | if (file_exists($this->cacheDir.'/'.$nonce) && file_get_contents($this->cacheDir.'/'.$nonce) + 300 > time()) { |
45 | throw new NonceExpiredException('Previously used nonce detected'); | 45 | throw new NonceExpiredException('Previously used nonce detected'); |
46 | } | 46 | } |
47 | |||
48 | // If cache directory does not exist we create it | ||
49 | if (!is_dir($this->cacheDir)) { | ||
50 | mkdir($this->cacheDir, 0777, true); | ||
51 | } | ||
52 | |||
47 | file_put_contents($this->cacheDir.'/'.$nonce, time()); | 53 | file_put_contents($this->cacheDir.'/'.$nonce, time()); |
48 | 54 | ||
49 | // Valide le Secret | 55 | // Valide le Secret |