Skip to content
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
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@

### Changed

- `Innmind\HttpAuthentication\Authenticator::__invoke()` now returns an `Innmind\Immutable\Attempt`
- All resolvers now return an `Innmind\Immutable\Attempt`
- All authenticators now return an `Innmind\Immutable\Attempt`
- All authenticators can return any type inside the `Attempt`

### Removed

- All resolvers have been replaced by `callable`s
- `Innmind\HttpAuthentication\ViaStorage`
- `Innmind\HttpAuthentication\Any`
- `Innmind\HttpAuthentication\ValidateAuthorizationHeader`
- `Innmind\HttpAuthentication\Authenticator`
- `Innmind\HttpAuthentication\Identity`

## 4.0.0 - 2023-11-01

Expand Down
35 changes: 0 additions & 35 deletions src/Any.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/Authenticator.php

This file was deleted.

9 changes: 0 additions & 9 deletions src/Identity.php

This file was deleted.

33 changes: 0 additions & 33 deletions src/ValidateAuthorizationHeader.php

This file was deleted.

17 changes: 13 additions & 4 deletions src/ViaAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Innmind\HttpAuthentication;

use Innmind\HttpAuthentication\ViaAuthorization\Resolver;
use Innmind\Http\{
ServerRequest,
Header\Authorization,
Expand All @@ -14,15 +13,25 @@
Predicate\Instance,
};

final class ViaAuthorization implements Authenticator
/**
* @template T
*/
final class ViaAuthorization
{
private Resolver $resolve;
/** @var callable(AuthorizationValue): Attempt<T> */
private $resolve;

public function __construct(Resolver $resolve)
/**
* @param callable(AuthorizationValue): Attempt<T> $resolve
*/
public function __construct(callable $resolve)
{
$this->resolve = $resolve;
}

/**
* @return Attempt<T>
*/
public function __invoke(ServerRequest $request): Attempt
{
return $request
Expand Down
17 changes: 0 additions & 17 deletions src/ViaAuthorization/NullResolver.php

This file was deleted.

16 changes: 0 additions & 16 deletions src/ViaAuthorization/Resolver.php

This file was deleted.

17 changes: 13 additions & 4 deletions src/ViaBasicAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,31 @@

namespace Innmind\HttpAuthentication;

use Innmind\HttpAuthentication\ViaBasicAuthorization\Resolver;
use Innmind\Http\{
ServerRequest,
Header\Authorization,
};
use Innmind\Immutable\Attempt;

final class ViaBasicAuthorization implements Authenticator
/**
* @template T
*/
final class ViaBasicAuthorization
{
private Resolver $resolve;
/** @var callable(string, string): Attempt<T> */
private $resolve;

public function __construct(Resolver $resolve)
/**
* @param callable(string, string): Attempt<T> $resolve
*/
public function __construct(callable $resolve)
{
$this->resolve = $resolve;
}

/**
* @return Attempt<T>
*/
public function __invoke(ServerRequest $request): Attempt
{
return $request
Expand Down
16 changes: 0 additions & 16 deletions src/ViaBasicAuthorization/NullResolver.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/ViaBasicAuthorization/Resolver.php

This file was deleted.

18 changes: 14 additions & 4 deletions src/ViaForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,35 @@

namespace Innmind\HttpAuthentication;

use Innmind\HttpAuthentication\ViaForm\Resolver;
use Innmind\Http\{
ServerRequest,
ServerRequest\Form,
Method,
};
use Innmind\Immutable\{
Maybe,
Attempt,
};

final class ViaForm implements Authenticator
/**
* @template T
*/
final class ViaForm
{
private Resolver $resolve;
/** @var callable(Form): Attempt<T> */
private $resolve;

public function __construct(Resolver $resolve)
/**
* @param callable(Form): Attempt<T> $resolve
*/
public function __construct(callable $resolve)
{
$this->resolve = $resolve;
}

/**
* @return Attempt<T>
*/
public function __invoke(ServerRequest $request): Attempt
{
return Maybe::just($request)
Expand Down
17 changes: 0 additions & 17 deletions src/ViaForm/NullResolver.php

This file was deleted.

16 changes: 0 additions & 16 deletions src/ViaForm/Resolver.php

This file was deleted.

37 changes: 0 additions & 37 deletions src/ViaStorage.php

This file was deleted.

Loading
Loading