22
33namespace ByJG \Session ;
44
5+ use ByJG \Util \JwtKeyInterface ;
6+ use ByJG \Util \JwtKeySecret ;
7+ use ByJG \Util \JwtRsaKey ;
8+
59class SessionConfig
610{
711 protected $ serverName ;
@@ -10,8 +14,7 @@ class SessionConfig
1014 protected $ timeoutMinutes = 20 ;
1115 protected $ cookieDomain = null ;
1216 protected $ cookiePath = '/ ' ;
13- protected $ secretKey = null ;
14- protected $ publicKey = null ;
17+ protected $ jwtKey = null ;
1518 protected $ replaceSessionHandler = null ;
1619
1720 /**
@@ -45,14 +48,12 @@ public function withCookie($domain, $path = "/") {
4548 }
4649
4750 public function withSecret ($ secret ) {
48- $ this ->secretKey = $ secret ;
49- $ this ->publicKey = null ;
51+ $ this ->jwtKey = new JwtKeySecret ($ secret );
5052 return $ this ;
5153 }
5254
5355 public function withRsaSecret ($ private , $ public ) {
54- $ this ->secretKey = $ private ;
55- $ this ->publicKey = $ public ;
56+ $ this ->jwtKey = new JwtRsaKey ($ private , $ public );
5657 return $ this ;
5758 }
5859
@@ -102,19 +103,11 @@ public function getCookiePath()
102103 }
103104
104105 /**
105- * @return null
106- */
107- public function getSecretKey ()
108- {
109- return $ this ->secretKey ;
110- }
111-
112- /**
113- * @return null
106+ * @return JwtKeyInterface
114107 */
115- public function getPublicKey ()
108+ public function getKey ()
116109 {
117- return $ this ->publicKey ;
110+ return $ this ->jwtKey ;
118111 }
119112
120113 public function isReplaceSession () {
0 commit comments