Skip to content

Remove getters from authentication methods #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions spec/Authentication/BasicAuthSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ function it_is_initializable()
$this->shouldHaveType('Http\Message\Authentication\BasicAuth');
}

function it_has_a_username()
{
$this->getUsername()->shouldReturn('john.doe');
}

function it_has_a_password()
{
$this->getPassword()->shouldReturn('secret');
}

function it_authenticates_a_request(RequestInterface $request, RequestInterface $newRequest)
{
$request->withHeader('Authorization', 'Basic '.base64_encode('john.doe:secret'))->willReturn($newRequest);
Expand Down
5 changes: 0 additions & 5 deletions spec/Authentication/BearerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ function it_is_initializable()
$this->shouldHaveType('Http\Message\Authentication\Bearer');
}

function it_has_a_token()
{
$this->getToken()->shouldReturn('token');
}

function it_authenticates_a_request(RequestInterface $request, RequestInterface $newRequest)
{
$request->withHeader('Authorization', 'Bearer token')->willReturn($newRequest);
Expand Down
9 changes: 0 additions & 9 deletions spec/Authentication/ChainSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ function it_is_initializable()
$this->shouldHaveType('Http\Message\Authentication\Chain');
}

function it_accepts_an_authentication_chain_in_the_constructor(Authentication $auth1, Authentication $auth2)
{
$chain = [$auth1, $auth2];

$this->beConstructedWith($chain);

$this->getAuthenticationChain()->shouldReturn($chain);
}

function it_throws_an_exception_when_non_authentication_is_passed()
{
$this->beConstructedWith(['authentication']);
Expand Down
10 changes: 0 additions & 10 deletions spec/Authentication/MatchingSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ function it_is_initializable()
$this->shouldHaveType('Http\Message\Authentication\Matching');
}

function it_has_an_authentication(Authentication $authentication)
{
$this->getAuthentication()->shouldReturn($authentication);
}

function it_has_a_matcher()
{
$this->getMatcher()->shouldReturn($this->matcher);
}

function it_authenticates_a_request(Authentication $authentication, RequestInterface $request, RequestInterface $newRequest)
{
$authentication->authenticate($request)->willReturn($newRequest);
Expand Down
10 changes: 0 additions & 10 deletions spec/Authentication/WsseSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ function it_is_initializable()
$this->shouldHaveType('Http\Message\Authentication\Wsse');
}

function it_has_a_username()
{
$this->getUsername()->shouldReturn('john.doe');
}

function it_has_a_password()
{
$this->getPassword()->shouldReturn('secret');
}

function it_authenticates_a_request(
RequestInterface $request,
RequestInterface $newRequest,
Expand Down
10 changes: 9 additions & 1 deletion src/Authentication/BasicAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
*/
final class BasicAuth implements Authentication
{
use UserPasswordPair;
/**
* @var string
*/
private $username;

/**
* @var string
*/
private $password;

/**
* @param string $username
Expand Down
10 changes: 0 additions & 10 deletions src/Authentication/Bearer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ public function __construct($token)
$this->token = $token;
}

/**
* Returns the token.
*
* @return string
*/
public function getToken()
{
return $this->token;
}

/**
* {@inheritdoc}
*/
Expand Down
10 changes: 0 additions & 10 deletions src/Authentication/Chain.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ public function __construct(array $authenticationChain = [])
$this->authenticationChain = $authenticationChain;
}

/**
* Returns the current authentication chain.
*
* @return Authentication[]
*/
public function getAuthenticationChain()
{
return $this->authenticationChain;
}

/**
* {@inheritdoc}
*/
Expand Down
20 changes: 0 additions & 20 deletions src/Authentication/Matching.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,6 @@ public function __construct(Authentication $authentication, callable $matcher =
$this->matcher = $matcher;
}

/**
* Returns the authentication.
*
* @return string
*/
public function getAuthentication()
{
return $this->authentication;
}

/**
* Returns the matcher.
*
* @return callable
*/
public function getMatcher()
{
return $this->matcher;
}

/**
* {@inheritdoc}
*/
Expand Down
41 changes: 0 additions & 41 deletions src/Authentication/UserPasswordPair.php

This file was deleted.

10 changes: 9 additions & 1 deletion src/Authentication/Wsse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
*/
final class Wsse implements Authentication
{
use UserPasswordPair;
/**
* @var string
*/
private $username;

/**
* @var string
*/
private $password;

/**
* @param string $username
Expand Down