Security.salt value in controller
Asked Answered
E

4

1

In cakephp there is one file core.php It contains

Configure::write('Security.salt', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

How can i get the value of Security.salt in controller in cakephp.

Thanks

Entrant answered 27/9, 2013 at 7:19 Comment(0)
I
3

Just try like this

Configure::read('Security.salt');

it will give you the value. For more info check here

Interdental answered 27/9, 2013 at 7:35 Comment(1)
This method works pre 3.x, take a look at my below answer for CakePHP 3.x.Exuberant
E
4

The above answers have not proven to be successful in CakePHP3.

Configure::Read('Security.salt') will return a blank value.

In-order to read the salt from the configuration file you'll need to include the Security namespace:

use Cake\Utility\Security;

And you can retrieve the value of the salt using:

Security::salt()

Exuberant answered 26/3, 2016 at 19:23 Comment(1)
Glad to have helped!Exuberant
I
3

Just try like this

Configure::read('Security.salt');

it will give you the value. For more info check here

Interdental answered 27/9, 2013 at 7:35 Comment(1)
This method works pre 3.x, take a look at my below answer for CakePHP 3.x.Exuberant
P
0
Configure::read("Security.salt");
Peirce answered 27/9, 2013 at 7:36 Comment(0)
D
0

You can get Security.salt value from below given url

http://www.sethcardoza.com/tools/random-password-generator/

Use 40 char long Salt

Configure::write('Security.salt','#IDjVn^BeZQ_kK)V5oFzk#s&8LSq44zVqN36SP^T');

Decoration answered 21/10, 2014 at 11:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.