Skip to content

Commit

Permalink
Fix compatibility by removing type constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 24, 2024
1 parent 5bd4756 commit 83d9b56
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/php/web/auth/oauth/ByCertificate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct($clientId, $fingerprint, $privateKey, $validity= 360
}

/** Returns parameters to be used in authentication process */
public function params(string $endpoint, int $time= null): array {
public function params(string $endpoint, $time= null): array {
$time ?? $time= time();
$jwt= new JWT(['alg' => 'RS256', 'typ' => 'JWT', 'x5t' => JWT::base64(hex2bin($this->fingerprint))], [
'aud' => $endpoint,
Expand Down
2 changes: 1 addition & 1 deletion src/main/php/web/auth/oauth/BySecret.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct($clientId, $secret) {
public function secret() { return $this->secret; }

/** Returns parameters to be used in authentication process */
public function params(string $endpoint, int $time= null): array {
public function params(string $endpoint, $time= null): array {
return [
'client_id' => $this->key,
'client_secret' => $this->secret->reveal(),
Expand Down
4 changes: 2 additions & 2 deletions src/main/php/web/auth/oauth/Credentials.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ abstract class Credentials {

static function __static() {
self::$UNSET= new class(null) extends Credentials {
public function params(string $endpoint, int $time= null): array {
public function params(string $endpoint, $time= null): array {
throw new IllegalStateException('No credentials set');
}
};
Expand All @@ -24,5 +24,5 @@ public function __construct($key) {
}

/** Returns parameters to be used in authentication process */
public abstract function params(string $endpoint, int $time= null): array;
public abstract function params(string $endpoint, $time= null): array;
}
8 changes: 7 additions & 1 deletion src/main/php/web/auth/oauth/Signature.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
class Signature {
private $consumer, $token;

public function __construct(BySecret $consumer, BySecret $token= null) {
/**
* Creates a new signature
*
* @param web.auth.oauth.BySecret $consumer
* @param ?web.auth.oauth.BySecret $token
*/
public function __construct($consumer, $token= null) {
$this->consumer= $consumer;
$this->token= $token;
}
Expand Down

0 comments on commit 83d9b56

Please sign in to comment.