File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Yii Framework 2 redis extension Change Log
442.0.16 under development
55------------------------ 
66
7- -  no changes in this release. 
7+ -  Enh  # 223 : Add  ` Connection::$username `  for using username for authentication (samdark, rvkulikov) 
88
99
10102.0.15 May 05, 2021
Original file line number Diff line number Diff line change @@ -276,6 +276,14 @@ class Connection extends Component
276276 * @since 2.0.1 
277277 */ 
278278 public  $ unixSocket
279+  /** 
280+  * @var string|null username for establishing DB connection. Defaults to `null` meaning AUTH command will be performed without username. 
281+  * Username was introduced in Redis 6. 
282+  * @link https://redis.io/commands/auth 
283+  * @link https://redis.io/topics/acl 
284+  * @since 2.0.16 
285+  */ 
286+  public  $ username
279287 /** 
280288 * @var string the password for establishing DB connection. Defaults to null meaning no AUTH command is sent. 
281289 * See https://redis.io/commands/auth 
@@ -638,7 +646,7 @@ public function open()
638646 stream_socket_enable_crypto ($ sockettrue , STREAM_CRYPTO_METHOD_TLS_CLIENT );
639647 }
640648 if  ($ this password  !== null ) {
641-  $ this executeCommand ('AUTH ' , [$ this password ]);
649+  $ this executeCommand ('AUTH ' , array_filter ( [$ this username ,  $ this -> password ]) );
642650 }
643651 if  ($ this database  !== null ) {
644652 $ this executeCommand ('SELECT ' , [$ this database ]);
                         You can’t perform that action at this time. 
           
                  
0 commit comments