Skip to content

A library to help with generating JWT tokens based on LDAP connection.

License

Notifications You must be signed in to change notification settings

P4BGroup/ldap-jwt-authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P4BGroup Authentication

JWT Authentication service using LDAP connections for Phalcon Projects

Latest Stable Version License Maintainability Total Downloads Test Coverage Build Status composer.lock

Usage

$ldap = new Laminas\Ldap\Ldap([..]);
$authService = new AuthenticationService($ldap);
$jwtTokensService = new JWTTokensService($algorithm, $encodeKey, $decodeKey);

/** @param P4BGroup\Authentication\User $user */
$user = $authService->authenticateUser($username, $password, $userBaseDn);

$claims = new P4BGroup\Authentication\Claims();
$claims->setData($user->toArray())
->setSubject(Claims::SUBJECT_REFRESH)
->setExpirationTime(new DateTime("+10 minutes"))

$accessToken = $jwtTokensService->encode($claims);
$refreshToken = $jwtTokensService->encode($claims->setSubject(Claims::SUBJECT_REFRESH)->setExpirationTime(new DateTime("+1 hour"));

About

A library to help with generating JWT tokens based on LDAP connection.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages