Skip to content
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

Bump ecphp/cas-lib to version 3.0 #11

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v3

- name: Install the Nix package manager
uses: cachix/install-nix-action@v19
uses: cachix/install-nix-action@v20

- name: Checks
run: nix run nixpkgs#nodePackages.prettier -- --check .
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2019-2023, European Union.
Copyright (c) 2019-2024, European Union.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 4 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
],
"homepage": "https://github.com/ecphp/",
"require": {
"php": ">= 8.0.2",
"php": ">= 8.1",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"ecphp/cas-lib": "^2.0",
"ecphp/cas-lib": "^3.0",
"laravel/framework": "^9 || ^10"
},
"require-dev": {
Expand All @@ -37,9 +35,9 @@
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true,
"ergebnis/composer-normalize": true,
"phpro/grumphp": true,
"ergebnis/composer-normalize": true
"phpstan/extension-installer": true
}
}
}
3 changes: 1 addition & 2 deletions src/Auth/CasGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@

public function __construct(
private ?UserProvider $provider,
private Request $request,

Check failure on line 30 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Property EcPhp\LaravelCas\Auth\CasGuard::$request is never read, only written.

Check failure on line 30 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Property EcPhp\LaravelCas\Auth\CasGuard::$request is never read, only written.

Check failure on line 30 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Property EcPhp\LaravelCas\Auth\CasGuard::$request is never read, only written.

Check failure on line 30 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Property EcPhp\LaravelCas\Auth\CasGuard::$request is never read, only written.

Check failure on line 30 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Property EcPhp\LaravelCas\Auth\CasGuard::$request is never read, only written.

Check failure on line 30 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Property EcPhp\LaravelCas\Auth\CasGuard::$request is never read, only written.
private Session $session
) {
}
) {}

public function attempt(array $credentials): ?Authenticatable

Check failure on line 34 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::attempt() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 34 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::attempt() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 34 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::attempt() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 34 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::attempt() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 34 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::attempt() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 34 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::attempt() has parameter $credentials with no value type specified in iterable type array.
{
$user = $this->provider->retrieveByCredentials($credentials);

Check failure on line 36 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Cannot call method retrieveByCredentials() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 36 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Cannot call method retrieveByCredentials() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 36 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Cannot call method retrieveByCredentials() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 36 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Cannot call method retrieveByCredentials() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 36 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Cannot call method retrieveByCredentials() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 36 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Cannot call method retrieveByCredentials() on Illuminate\Contracts\Auth\UserProvider|null.

if (null === $user) {
return null;
Expand All @@ -50,12 +49,12 @@
return null !== $this->user();
}

public function getJsonParams()

Check failure on line 52 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::getJsonParams() has no return type specified.

Check failure on line 52 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::getJsonParams() has no return type specified.

Check failure on line 52 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::getJsonParams() has no return type specified.

Check failure on line 52 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::getJsonParams() has no return type specified.

Check failure on line 52 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::getJsonParams() has no return type specified.

Check failure on line 52 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::getJsonParams() has no return type specified.
{
return null;
}

public function getName()

Check failure on line 57 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::getName() has no return type specified.

Check failure on line 57 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::getName() has no return type specified.

Check failure on line 57 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::getName() has no return type specified.

Check failure on line 57 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::getName() has no return type specified.

Check failure on line 57 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::getName() has no return type specified.

Check failure on line 57 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::getName() has no return type specified.
{
return sprintf('login_%s_%s', $this->name, sha1(self::class));
}
Expand All @@ -76,10 +75,10 @@
return null;
}

return $this->user->user;

Check failure on line 78 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Cannot access property $user on Illuminate\Contracts\Auth\Authenticatable|null.

Check failure on line 78 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Cannot access property $user on Illuminate\Contracts\Auth\Authenticatable|null.

Check failure on line 78 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Cannot access property $user on Illuminate\Contracts\Auth\Authenticatable|null.

Check failure on line 78 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Cannot access property $user on Illuminate\Contracts\Auth\Authenticatable|null.

Check failure on line 78 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Cannot access property $user on Illuminate\Contracts\Auth\Authenticatable|null.

Check failure on line 78 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Cannot access property $user on Illuminate\Contracts\Auth\Authenticatable|null.
}

public function logout()

Check failure on line 81 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::logout() has no return type specified.

Check failure on line 81 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::logout() has no return type specified.

Check failure on line 81 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::logout() has no return type specified.

Check failure on line 81 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::logout() has no return type specified.

Check failure on line 81 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::logout() has no return type specified.

Check failure on line 81 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::logout() has no return type specified.
{
$this->user = null;
$this->loggedOut = true;
Expand All @@ -101,10 +100,10 @@
return null;
}

return $this->provider->retrieveCasUser();

Check failure on line 103 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Cannot call method retrieveCasUser() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 103 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Cannot call method retrieveCasUser() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 103 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Cannot call method retrieveCasUser() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 103 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Cannot call method retrieveCasUser() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 103 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Cannot call method retrieveCasUser() on Illuminate\Contracts\Auth\UserProvider|null.

Check failure on line 103 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Cannot call method retrieveCasUser() on Illuminate\Contracts\Auth\UserProvider|null.
}

public function validate(array $credentials = [])

Check failure on line 106 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::validate() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 106 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::validate() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 106 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::validate() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 106 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasGuard::validate() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 106 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasGuard::validate() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 106 in src/Auth/CasGuard.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasGuard::validate() has parameter $credentials with no value type specified in iterable type array.
{
if ([] === $credentials) {
return false;
Expand Down
7 changes: 2 additions & 5 deletions src/Auth/CasUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@

public function __construct(
private Session $session
) {
}
) {}

public function getModel(): ?Authenticatable
{
return $this->model;
}

public function retrieveByCredentials(array $credentials): ?Authenticatable

Check failure on line 36 in src/Auth/CasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 36 in src/Auth/CasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 36 in src/Auth/CasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 36 in src/Auth/CasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelCas\Auth\CasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 36 in src/Auth/CasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelCas\Auth\CasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 36 in src/Auth/CasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelCas\Auth\CasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.
{
if ([] === $credentials) {
return null;
Expand Down Expand Up @@ -63,9 +62,7 @@
return $this->session->get(auth()->guard($this->guard_name)->getName());
}

public function updateRememberToken(Authenticatable $user, $token)
{
}
public function updateRememberToken(Authenticatable $user, $token) {}

public function validateCredentials(Authenticatable $user, array $credentials)
{
Expand Down
8 changes: 1 addition & 7 deletions src/Auth/User/CasUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public function getAuthIdentifierName(): string

/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword(): ?string
{
Expand All @@ -103,8 +101,6 @@ public function getRememberToken(): string

/**
* Get the column name for the "remember me" token.
*
* @return string
*/
public function getRememberTokenName(): ?string
{
Expand All @@ -121,9 +117,7 @@ public function getRoles(): array
*
* @param mixed $value
*/
public function setRememberToken($value): void
{
}
public function setRememberToken($value): void {}

/**
* Get the storage.
Expand Down
42 changes: 2 additions & 40 deletions src/Config/Laravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use EcPhp\CasLib\Contract\Configuration\PropertiesInterface;
use Illuminate\Routing\Router;
use Illuminate\Routing\Router as RouterInterface;
use ReturnTypeWillChange;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

Expand All @@ -39,46 +38,9 @@ public function __construct(
);
}

public function all(): array
public function jsonSerialize(): mixed
{
return $this->cas->all();
}

/**
* @param mixed $offset
*/
#[ReturnTypeWillChange]
public function offsetExists($offset): bool
{
return $this->cas->offsetExists($offset);
}

/**
* @param mixed $offset
*
* @return array<string, mixed>|mixed
*/
#[ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->cas->offsetGet($offset);
}

/**
* @param mixed $offset
* @param mixed $value
*/
public function offsetSet($offset, $value): void
{
$this->cas->offsetSet($offset, $value);
}

/**
* @param mixed $offset
*/
public function offsetUnset($offset): void
{
$this->cas->offsetUnset($offset);
return $this->cas->jsonSerialize();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __invoke(
Request $request,
CasInterface $cas,
ServerRequestInterface $serverRequest,
): Redirector|ResponseInterface|RedirectResponse {
): Redirector|RedirectResponse|ResponseInterface {
$parameters = $request->query->all() + [
'renew' => null !== auth()->guard()->user(),
];
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/LogoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __invoke(
Request $request,
CasInterface $cas,
ServerRequestInterface $serverRequest
): RedirectResponse|Redirector|ResponseInterface {
): Redirector|RedirectResponse|ResponseInterface {
$response = $cas
->logout(
$serverRequest->withQueryParams(
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/ProxyCallbackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __invoke(
Request $request,
CasInterface $cas,
ServerRequestInterface $serverRequest
): ResponseInterface|Response {
): Response|ResponseInterface {
return $cas
->handleProxyCallback(
$serverRequest
Expand Down
3 changes: 1 addition & 2 deletions src/Middleware/CasAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ final class CasAuthenticator
public function __construct(
private CasInterface $cas,
private ServerRequestInterface $serverRequest
) {
}
) {}

public function handle(Request $request, Closure $next): mixed
{
Expand Down
Loading