LdapAuthenticator example


    public function testAuthenticate()
    {
        $decorated = $this->createMock(AuthenticatorInterface::class);
        $passport = new Passport(new UserBadge('test')new PasswordCredentials('s3cret'));
        $decorated
            ->expects($this->once())
            ->method('authenticate')
            ->willReturn($passport)
        ;

        $authenticator = new LdapAuthenticator($decorated, 'serviceId');
        $request = new Request();

        $authenticator->authenticate($request);

        /** @var LdapBadge $badge */
        $badge = $passport->getBadge(LdapBadge::class);
        $this->assertNotNull($badge);
        $this->assertSame('serviceId', $badge->getLdapServiceId());
    }
}
Home | Imprint | This part of the site doesn't use cookies.