1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-09 17:46:31 +02:00

Allow authentication via header for scripting purposes

This commit is contained in:
Marco Dickert
2018-03-26 17:15:36 +02:00
parent 3117a15790
commit 2a37becfa6
3 changed files with 18 additions and 0 deletions

View File

@@ -3985,6 +3985,12 @@ function IFM( params ) {
if( $this->config['auth'] == 0 )
return true;
if( isset( $_SERVER['HTTP_X_IFM_AUTH'] ) && ! empty( $_SERVER['HTTP_X_IFM_AUTH'] ) ) {
$cred = split( ":", base64_decode( $_SERVER['HTTP_X_IFM_AUTH'] ) );
if( count( $cred ) == 2 && $this->checkCredentials( $cred[0], $cred[1] ) )
return true;
}
if( session_status() !== PHP_SESSION_ACTIVE ) {
if( isset( $this->config['session_lifetime'] ) )
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );

View File

@@ -3985,6 +3985,12 @@ function IFM( params ) {
if( $this->config['auth'] == 0 )
return true;
if( isset( $_SERVER['HTTP_X_IFM_AUTH'] ) && ! empty( $_SERVER['HTTP_X_IFM_AUTH'] ) ) {
$cred = split( ":", base64_decode( $_SERVER['HTTP_X_IFM_AUTH'] ) );
if( count( $cred ) == 2 && $this->checkCredentials( $cred[0], $cred[1] ) )
return true;
}
if( session_status() !== PHP_SESSION_ACTIVE ) {
if( isset( $this->config['session_lifetime'] ) )
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );

View File

@@ -965,6 +965,12 @@ f00bar;
if( $this->config['auth'] == 0 )
return true;
if( isset( $_SERVER['HTTP_X_IFM_AUTH'] ) && ! empty( $_SERVER['HTTP_X_IFM_AUTH'] ) ) {
$cred = split( ":", base64_decode( $_SERVER['HTTP_X_IFM_AUTH'] ) );
if( count( $cred ) == 2 && $this->checkCredentials( $cred[0], $cred[1] ) )
return true;
}
if( session_status() !== PHP_SESSION_ACTIVE ) {
if( isset( $this->config['session_lifetime'] ) )
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );