Deon George 673f070cb7
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 33s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m22s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 3m39s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Add support for SASL Kerberous realms. Closes #114
2025-01-18 22:55:50 +11:00

19 lines
403 B
PHP

<?php
namespace App\Classes\LDAP\Attribute\Password;
final class SASL extends Base
{
public const key = 'SASL';
public function encode(string $password): string
{
if (! str_contains($password,'@'))
return '';
// Ensure our id is lowercase, and realm is uppercase
list($id,$realm) = explode('@',$password);
return sprintf('{%s}%s@%s',self::key,strtolower($id),strtoupper($realm));
}
}