neo4j-php / neo4j-symfony

Symfony Bundle for the Neo4j Graph Database
MIT License
78 stars 41 forks source link

Failed to unserialize security token #61

Closed Surfoo closed 5 years ago

Surfoo commented 5 years ago

Hello,

I try to use neo4j with Symfony Guard, but I got an error about the unserialized security token:

Here the error log:

[2019-01-28 07:41:03] security.WARNING: Failed to unserialize the security token from the session. {"key":"_security_main","received":"C:67:\"Symfony\\Component\\Security\\Guard\\Token\\PostAuthenticationGuardToken\":3481:{a:2:{i:0;s:4:\"main\";i:1;s:3446:\"a:4:{i:0;O:31:\"neo4j_ogm_proxy_App_Entity_User\":23:{s:35:\"\u0000neo4j_ogm_proxy_App_Entity_User\u0000em\";N;s:44:\"\u0000neo4j_ogm_proxy_App_Entity_User\u0000initialized\";a:0:{}s:45:\"\u0000neo4j_ogm_proxy_App_Entity_User\u0000initializers\";a:0:{}s:37:\"\u0000neo4j_ogm_proxy_App_Entity_User\u0000node\";O:32:\"GraphAware\\Bolt\\Result\\Type\\Node\":3:{s:11:\"\u0000*\u0000identity\";i:31;s:9:\"\u0000*\u0000labels\";a:1:{i:0;s:4:\"User\";}s:13:\"\u0000*\u0000properties\";a:14:{s:17:\"membershipLevelId\";i:3;s:9:\"findCount\";i:0;s:9:\"avatarUrl\";s:88:\"https://example.com/test.jpg\";s:9:\"bannerUrl\";s:91:\"https://example.com/test.jpg\";s:6:\"userId\";i:1;s:5:\"token\";s:520:\"randomtoken\";s:9:\"createdAt\";i:1548630927;s:15:\"tokenExpiration\";i:1548664782;s:9:\"hideCount\";i:0;s:14:\"favoritePoints\";i:0;s:13:\"referenceCode\";s:7:\"1\";s:9:\"updatedAt\";i:1548661185;s:12:\"refreshToken\";s:64:\"randomtoken\";s:8:\"username\";s:6:\"username\";}}s:5:\"\u0000*\u0000id\";i:31;s:23:\"\u0000App\\Entity\\User\u0000userId\";i:1220432;s:30:\"\u0000App\\Entity\\User\u0000referenceCode\";s:7:\"1\";s:25:\"\u0000App\\Entity\\User\u0000username\";s:6:\"username\";s:34:\"\u0000App\\Entity\\User\u0000membershipLevelId\";i:3;s:26:\"\u0000App\\Entity\\User\u0000avatarUrl\";s:88:\"https://example.com/test.jpg\";s:26:\"\u0000App\\Entity\\User\u0000bannerUrl\";s:91:\"https://example.com/test.jpg\";s:32:\"\u0000App\\Entity\\User\u0000homeCoordinates\";N;s:26:\"\u0000App\\Entity\\User\u0000findCount\";i:0;s:26:\"\u0000App\\Entity\\User\u0000hideCount\";i:0;s:31:\"\u0000App\\Entity\\User\u0000favoritePoints\";i:0;s:22:\"\u0000App\\Entity\\User\u0000token\";s:520:\"randomtoken\";s:32:\"\u0000App\\Entity\\User\u0000tokenExpiration\";i:1548664861;s:26:\"\u0000App\\Entity\\User\u0000createdAt\";O:8:\"DateTime\":3:{s:4:\"date\";s:26:\"2019-01-27 23:15:27.000000\";s:13:\"timezone_type\";i:1;s:8:\"timezone\";s:6:\"+00:00\";}s:26:\"\u0000App\\Entity\\User\u0000updatedAt\";O:8:\"DateTime\":3:{s:4:\"date\";s:26:\"2019-01-28 07:41:03.650728\";s:13:\"timezone_type\";i:3;s:8:\"timezone\";s:3:\"UTC\";}s:22:\"\u0000App\\Entity\\User\u0000roles\";a:0:{}s:24:\"\u0000App\\Entity\\User\u0000friends\";N;s:21:\"\u0000App\\Entity\\User\u0000logs\";N;}i:1;b:1;i:2;a:1:{i:0;O:41:\"Symfony\\Component\\Security\\Core\\Role\\Role\":1:{s:47:\"\u0000Symfony\\Component\\Security\\Core\\Role\\Role\u0000role\";s:9:\"ROLE_USER\";}}i:3;a:0:{}}\";}}","exception":"[object] (ErrorException(code: 57873340): Class not found: neo4j_ogm_proxy_App_Entity_User at /home/baptiste/git/FriendLeagueActivity/vendor/symfony/security-http/Firewall/ContextListener.php:264)"} []

[2019-01-28 07:41:03] security.DEBUG: Read existing security token from the session. {"key":"_security_main","token_class":null} []
[2019-01-28 07:41:03] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"main","authenticators":1} []
[2019-01-28 07:41:03] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"main","authenticator":"App\\Surfoo\\GeocachingBundle\\Security\\GeocachingAuthenticator"} []
[2019-01-28 07:41:03] security.DEBUG: Guard authenticator does not support the request. {"firewall_key":"main","authenticator":"App\\Surfoo\\GeocachingBundle\\Security\\GeocachingAuthenticator"} []
[2019-01-28 07:41:03] security.INFO: Populated the TokenStorage with an anonymous Token. [] []

The exception here: "exception" => ErrorException {#274 ▼

message: "Class not found: neo4j_ogm_proxy_App_Entity_User"

#code: 57873340
#file: "/home/user/git/project/vendor/symfony/security-http/Firewall/ContextListener.php"
#line: 264
#severity: E_ERROR
trace: {▼
/home/user/git/project/vendor/symfony/security-http/Firewall/ContextListener.php:264 {▶}
Symfony\Component\Security\Http\Firewall\ContextListener::handleUnserializeCallback() {}
/home/user/git/project/vendor/symfony/security-core/Authentication/Token/AbstractToken.php:154 {▶}
/home/user/git/project/vendor/symfony/security-guard/Token/PostAuthenticationGuardToken.php:88 {▶}
Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken->unserialize() {}
/home/user/git/project/vendor/symfony/security-http/Firewall/ContextListener.php:242 {▶}
/home/user/git/project/vendor/symfony/security-http/Firewall/ContextListener.php:95 {▶}
/home/user/git/project/vendor/symfony/security-bundle/Debug/WrappedListener.php:46 {▶}
/home/user/git/project/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:35 {▶}
/home/user/git/project/vendor/symfony/security-http/Firewall.php:90 {▶}
/home/user/git/project/vendor/symfony/security-bundle/EventListener/FirewallListener.php:48 {▶}
/home/user/git/project/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:111 {▶}
/home/user/git/project/vendor/symfony/event-dispatcher/EventDispatcher.php:212 {▶}
/home/user/git/project/vendor/symfony/event-dispatcher/EventDispatcher.php:44 {▶}
/home/user/git/project/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:145 {▶}
/home/user/git/project/vendor/symfony/http-kernel/HttpKernel.php:126 {▶}
/home/user/git/project/vendor/symfony/http-kernel/HttpKernel.php:67 {▶}
/home/user/git/project/vendor/symfony/http-kernel/Kernel.php:198 {▶}
/home/user/git/project/public/index.php:37 {▼

Is there an issue or a bad configuration on my side?

glembus commented 5 years ago

Do you corectly configure #message: "Class not found: neo4j_ogm_proxy_App_Entity_User" class? Looks like on unserialize it can`t find this Entity. By the way maybe this is can help https://github.com/neo4j-contrib/neo4j-symfony/issues/31

xavismeh commented 5 years ago

Hello, this issue is not related to that bundle but to https://github.com/graphaware/neo4j-php-ogm instead. Please refer to the corresponding repository.

Thanks