Skip to content

Commit bf16829

Browse files
committed
update dependencies
1 parent 7dd63da commit bf16829

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- All authenticators now return an `Innmind\Immutable\Attempt`
88
- All authenticators can return any type inside the `Attempt`
9+
- Requires `innmind/foundation:~1.9`
910

1011
### Removed
1112

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
},
1717
"require": {
1818
"php": "~8.2",
19-
"innmind/immutable": "~5.18",
20-
"innmind/http": "~7.0"
19+
"innmind/foundation": "~1.9"
2120
},
2221
"autoload": {
2322
"psr-4": {

src/ViaAuthorization.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,19 @@
66
use Innmind\Http\{
77
ServerRequest,
88
Header\Authorization,
9-
Header\AuthorizationValue,
10-
};
11-
use Innmind\Immutable\{
12-
Attempt,
13-
Predicate\Instance,
149
};
10+
use Innmind\Immutable\Attempt;
1511

1612
/**
1713
* @template T
1814
*/
1915
final class ViaAuthorization
2016
{
21-
/** @var callable(AuthorizationValue): Attempt<T> */
17+
/** @var callable(Authorization): Attempt<T> */
2218
private $resolve;
2319

2420
/**
25-
* @param callable(AuthorizationValue): Attempt<T> $resolve
21+
* @param callable(Authorization): Attempt<T> $resolve
2622
*/
2723
public function __construct(callable $resolve)
2824
{
@@ -37,8 +33,6 @@ public function __invoke(ServerRequest $request): Attempt
3733
return $request
3834
->headers()
3935
->find(Authorization::class)
40-
->flatMap(static fn($header) => $header->values()->find(static fn() => true))
41-
->keep(Instance::of(AuthorizationValue::class))
4236
->attempt(static fn() => new \RuntimeException('Failed to resolve identity'))
4337
->flatMap(fn($value) => ($this->resolve)($value));
4438
}

tests/ViaAuthorizationTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
Method,
1010
ProtocolVersion,
1111
Headers,
12-
Header\Header,
13-
Header\Value\Value,
12+
Header,
13+
Header\Value,
1414
Header\Authorization,
15-
Header\AuthorizationValue,
1615
};
1716
use Innmind\Url\Url;
1817
use Innmind\Immutable\Attempt;
@@ -47,7 +46,7 @@ public function testReturnNothingWhenAuthorizationHeaderNotParsedCorrectly()
4746
Method::get,
4847
ProtocolVersion::v11,
4948
Headers::of(
50-
new Header('Authorization', new Value('Basic foo')),
49+
Header::of('Authorization', Value::of('Basic foo')),
5150
),
5251
);
5352

@@ -62,13 +61,13 @@ public function testInvokation()
6261
$authenticate = new ViaAuthorization(
6362
static fn($value) => Attempt::result($value),
6463
);
65-
$expected = new AuthorizationValue('Bearer', 'foo');
64+
$expected = Authorization::of('Bearer', 'foo');
6665
$request = ServerRequest::of(
6766
Url::of('/'),
6867
Method::get,
6968
ProtocolVersion::v11,
7069
Headers::of(
71-
new Authorization($expected),
70+
$expected,
7271
),
7372
);
7473

tests/ViaBasicAuthorizationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
Method,
1010
ProtocolVersion,
1111
Headers,
12-
Header\Header,
13-
Header\Value\Value,
12+
Header,
13+
Header\Value,
1414
Header\Authorization,
1515
};
1616
use Innmind\Url\Url;
@@ -46,7 +46,7 @@ public function testReturnNothingWhenAuthorizationHeaderNotParsedCorrectly()
4646
Method::get,
4747
ProtocolVersion::v11,
4848
Headers::of(
49-
new Header('Authorization', new Value('Basic foo')),
49+
Header::of('Authorization', Value::of('Basic foo')),
5050
),
5151
);
5252

0 commit comments

Comments
 (0)