Compare commits
2 Commits
911c6e3229
...
a57c5d8886
Author | SHA1 | Date | |
---|---|---|---|
a57c5d8886 | |||
c3344d1e2a |
@ -52,7 +52,7 @@ abstract class Base
|
|||||||
return $source === $this->encode($compare);
|
return $source === $this->encode($compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function salted_hash(string $password,string $algo,int $salt_size=8,string $salt=NULL): string
|
protected function salted_hash(string $password,string $algo,int $salt_size=8,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
if (is_null($salt))
|
if (is_null($salt))
|
||||||
$salt = hex2bin(random_salt($salt_size));
|
$salt = hex2bin(random_salt($salt_size));
|
||||||
|
@ -20,7 +20,7 @@ final class Blowfish extends Base
|
|||||||
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
if (is_null($salt))
|
if (is_null($salt))
|
||||||
$salt = sprintf('%s%d$%s',self::identifier,self::cost,random_salt(self::salt));
|
$salt = sprintf('%s%d$%s',self::identifier,self::cost,random_salt(self::salt));
|
||||||
|
@ -19,7 +19,7 @@ final class Crypt extends Base
|
|||||||
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
if (is_null($salt))
|
if (is_null($salt))
|
||||||
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt));
|
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt));
|
||||||
|
@ -19,7 +19,7 @@ final class ExtDes extends Base
|
|||||||
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
if (is_null($salt))
|
if (is_null($salt))
|
||||||
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt));
|
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt));
|
||||||
|
@ -19,7 +19,7 @@ final class MD5crypt extends Base
|
|||||||
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
if (is_null($salt))
|
if (is_null($salt))
|
||||||
$salt = sprintf('%s$%s',self::identifier,random_salt(self::salt));
|
$salt = sprintf('%s$%s',self::identifier,random_salt(self::salt));
|
||||||
|
@ -19,7 +19,7 @@ final class SHA256crypt extends Base
|
|||||||
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
if (is_null($salt))
|
if (is_null($salt))
|
||||||
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt));
|
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt));
|
||||||
|
@ -19,7 +19,7 @@ final class SHA512crypt extends Base
|
|||||||
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
return hash_equals($cp=self::password($source),crypt($compare,$cp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
if (is_null($salt))
|
if (is_null($salt))
|
||||||
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt));
|
$salt = sprintf('%s%s',self::identifier,random_salt(self::salt));
|
||||||
|
@ -12,7 +12,7 @@ final class SSHA256 extends Base
|
|||||||
return $source === $this->encode($compare,$this->salted_salt($source));
|
return $source === $this->encode($compare,$this->salted_salt($source));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha256',self::salt,$salt));
|
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha256',self::salt,$salt));
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ final class SSHA384 extends Base
|
|||||||
return $source === $this->encode($compare,$this->salted_salt($source));
|
return $source === $this->encode($compare,$this->salted_salt($source));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha384',self::salt,$salt));
|
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha384',self::salt,$salt));
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ final class SSHA512 extends Base
|
|||||||
return $source === $this->encode($compare,$this->salted_salt($source));
|
return $source === $this->encode($compare,$this->salted_salt($source));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password,string $salt=NULL): string
|
public function encode(string $password,?string $salt=NULL): string
|
||||||
{
|
{
|
||||||
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha512',self::salt,$salt));
|
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha512',self::salt,$salt));
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace App\Classes\LDAP;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
@ -36,7 +37,7 @@ final class Server
|
|||||||
public const OC_ABSTRACT = 0x02;
|
public const OC_ABSTRACT = 0x02;
|
||||||
public const OC_AUXILIARY = 0x03;
|
public const OC_AUXILIARY = 0x03;
|
||||||
|
|
||||||
public function __construct(string $connection=NULL)
|
public function __construct(?string $connection=NULL)
|
||||||
{
|
{
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
}
|
}
|
||||||
@ -49,6 +50,8 @@ final class Server
|
|||||||
'ldapsyntaxes' => $this->ldapsyntaxes,
|
'ldapsyntaxes' => $this->ldapsyntaxes,
|
||||||
'matchingrules' => $this->matchingrules,
|
'matchingrules' => $this->matchingrules,
|
||||||
'objectclasses' => $this->objectclasses,
|
'objectclasses' => $this->objectclasses,
|
||||||
|
'config' => config('ldap.connections.'.config('ldap.default')),
|
||||||
|
'name' => Arr::get($this->config,'name',__('No Server Name Yet')),
|
||||||
default => throw new Exception('Unknown key:' . $key),
|
default => throw new Exception('Unknown key:' . $key),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -66,7 +69,7 @@ final class Server
|
|||||||
* @testedin GetBaseDNTest::testBaseDNExists();
|
* @testedin GetBaseDNTest::testBaseDNExists();
|
||||||
* @todo Need to allow for the scenario if the baseDN is not readable by ACLs
|
* @todo Need to allow for the scenario if the baseDN is not readable by ACLs
|
||||||
*/
|
*/
|
||||||
public static function baseDNs(string $connection=NULL,bool $objects=TRUE): Collection
|
public static function baseDNs(?string $connection=NULL,bool $objects=TRUE): Collection
|
||||||
{
|
{
|
||||||
$cachetime = Carbon::now()
|
$cachetime = Carbon::now()
|
||||||
->addSeconds(Config::get('ldap.cache.time'));
|
->addSeconds(Config::get('ldap.cache.time'));
|
||||||
@ -211,7 +214,7 @@ final class Server
|
|||||||
* @throws ObjectNotFoundException
|
* @throws ObjectNotFoundException
|
||||||
* @testedin TranslateOidTest::testRootDSE();
|
* @testedin TranslateOidTest::testRootDSE();
|
||||||
*/
|
*/
|
||||||
public static function rootDSE(string $connection=NULL,Carbon $cachetime=NULL): ?Model
|
public static function rootDSE(?string $connection=NULL,Carbon $cachetime=NULL): ?Model
|
||||||
{
|
{
|
||||||
$e = new Entry;
|
$e = new Entry;
|
||||||
|
|
||||||
@ -231,7 +234,7 @@ final class Server
|
|||||||
* @return string
|
* @return string
|
||||||
* @throws ObjectNotFoundException
|
* @throws ObjectNotFoundException
|
||||||
*/
|
*/
|
||||||
public static function schemaDN(string $connection=NULL): string
|
public static function schemaDN(?string $connection=NULL): string
|
||||||
{
|
{
|
||||||
$cachetime = Carbon::now()->addSeconds(Config::get('ldap.cache.time'));
|
$cachetime = Carbon::now()->addSeconds(Config::get('ldap.cache.time'));
|
||||||
|
|
||||||
@ -299,10 +302,9 @@ final class Server
|
|||||||
*
|
*
|
||||||
* @param string $item Schema Item to Fetch
|
* @param string $item Schema Item to Fetch
|
||||||
* @param string|null $key
|
* @param string|null $key
|
||||||
* @return Collection|Base|NULL
|
* @return Collection|LDAPSyntax|Base|NULL
|
||||||
* @throws InvalidUsage
|
|
||||||
*/
|
*/
|
||||||
public function schema(string $item,string $key=NULL): Collection|LDAPSyntax|Base|NULL
|
public function schema(string $item,?string $key=NULL): Collection|LDAPSyntax|Base|NULL
|
||||||
{
|
{
|
||||||
// Ensure our item to fetch is lower case
|
// Ensure our item to fetch is lower case
|
||||||
$item = strtolower($item);
|
$item = strtolower($item);
|
||||||
|
@ -17,7 +17,7 @@ class Attribute extends Component
|
|||||||
/**
|
/**
|
||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(?LDAPAttribute $o,bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $na=NULL)
|
public function __construct(?LDAPAttribute $o,bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,?string $na=NULL)
|
||||||
{
|
{
|
||||||
$this->o = $o;
|
$this->o = $o;
|
||||||
$this->edit = $edit;
|
$this->edit = $edit;
|
||||||
|
@ -18,7 +18,7 @@ class AttributeType extends Component
|
|||||||
/**
|
/**
|
||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(LDAPAttribute $o,bool $new=FALSE,Collection $oc=NULL)
|
public function __construct(LDAPAttribute $o,bool $new=FALSE,?Collection $oc=NULL)
|
||||||
{
|
{
|
||||||
$this->o = $o;
|
$this->o = $o;
|
||||||
$this->oc = $oc;
|
$this->oc = $oc;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<div class="scrollbar-sidebar">
|
<div class="scrollbar-sidebar">
|
||||||
<div class="app-sidebar__inner">
|
<div class="app-sidebar__inner">
|
||||||
<ul class="vertical-nav-menu">
|
<ul class="vertical-nav-menu">
|
||||||
<li class="app-sidebar__heading">{{ $server ?? __('Server Name') }}</li>
|
<li class="app-sidebar__heading">{{ config('server')->name }}</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="font-icon-wrapper float-start me-1 server-icon">
|
<div class="font-icon-wrapper float-start me-1 server-icon">
|
||||||
<a class="p-0 m-0" href="{{ url('info') }}" onclick="return false;" style="display: contents;"><i class="fas fa-fw fa-info"></i></a>
|
<a class="p-0 m-0" href="{{ url('info') }}" onclick="return false;" style="display: contents;"><i class="fas fa-fw fa-info"></i></a>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border-radius: 5px;"><div class="page-title-icon f32"><i class="fas fa-upload"></i></div></td>
|
<td style="border-radius: 5px;"><div class="page-title-icon f32"><i class="fas fa-upload"></i></div></td>
|
||||||
<td class="top text-start align-text-top p-0 pt-2"><strong>@lang('LDIF Import')</strong><br><small>To Server XXX</small></td>
|
<td class="top text-start align-text-top p-0 pt-2"><strong>@lang('LDIF Import')</strong><br><small>@lang('To Server') <strong>{{ config('server')->name }}</strong></small></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@endsection
|
@endsection
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border-radius: 5px;"><div class="page-title-icon f32"><i class="fas fa-upload"></i></div></td>
|
<td style="border-radius: 5px;"><div class="page-title-icon f32"><i class="fas fa-upload"></i></div></td>
|
||||||
<td class="top text-start align-text-top p-0 pt-2"><strong>@lang('LDIF Import Result')</strong><br><small>To Server XXX</small></td>
|
<td class="top text-start align-text-top p-0 pt-2"><strong>@lang('LDIF Import Result')</strong><br><small>@lang('To Server') <strong>{{ config('server')->name }}</strong></small></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user