Skip to content

Commit

Permalink
fix vulnerabilities and fix import ldap group
Browse files Browse the repository at this point in the history
  • Loading branch information
ctresvauxp6 committed Jun 9, 2023
1 parent f76d57f commit 4d21eb3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/src/Command/LDAPImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private function importUsers() {
private function importGroups(): void {

$mailAttribute = $this->connector->getLdapEmailField();
$realNameAttribute = $this->connector->getLdapRealNameField();
$realNameAttribute = $this->connector->getLdapGroupNameField();
$groupMemberAttribute = $this->connector->getLdapGroupMemberField();

if ($this->connector->getLdapGroupFilter()) {
Expand Down Expand Up @@ -177,6 +177,8 @@ private function importGroups(): void {
$isNew = true;
$priorityMax++;
}
// dump($realNameAttribute);
// dd($ldapGroup);
$group->setName($ldapGroup->getAttribute($realNameAttribute)[0]);
$group->setOriginConnector($this->connector);
$this->em->persist($group);
Expand Down
2 changes: 1 addition & 1 deletion app/src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function setPassword(string $password): self
return $this;
}

public function getRoles()
public function getRoles(): array
{
$roles = json_decode($this->roles);

Expand Down
5 changes: 3 additions & 2 deletions app/src/Security/LoginFormAuthenticator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

namespace App\Security;
//use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;


use App\Entity\User;
use App\Service\LdapService;
Expand All @@ -22,7 +24,6 @@
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Util\TargetPathTrait;
use Symfony\Contracts\Translation\TranslatorInterface;
Expand Down Expand Up @@ -63,7 +64,7 @@ public function __construct(
$this->ldapService = $ldapService;
}

public function authenticate(Request $request): PassportInterface {
public function authenticate(Request $request): Passport {

$username = $request->request->get('username', '');
$csrf_token = $request->request->get('_csrf_token', '');
Expand Down

0 comments on commit 4d21eb3

Please sign in to comment.