Skip to content

Commit

Permalink
Fixed OAuth-Bug resolves #170
Browse files Browse the repository at this point in the history
  • Loading branch information
StanBarrows committed Sep 23, 2024
1 parent de193a1 commit 81b5220
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 61 deletions.
68 changes: 34 additions & 34 deletions src/DTO/Authentication/OAuth/IdentityServiceConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,44 @@ public static function make(array $data): self
frontchannelLogoutSessionSupported: Arr::get($data, 'frontchannel_logout_session_supported'),
backchannelLogoutSupported: Arr::get($data, 'backchannel_logout_supported'),
backchannelLogoutSessionSupported: Arr::get($data, 'backchannel_logout_session_supported'),
scopesSupported: Arr::get($data, 'scopes_supported'),
claimsSupported: Arr::get($data, 'claims_supported'),
grantTypesSupported: Arr::get($data, 'grant_types_supported'),
responseTypesSupported: Arr::get($data, 'response_types_supported'),
responseModesSupported: Arr::get($data, 'response_modes_supported'),
tokenEndpointAuthMethodsSupported: Arr::get($data, 'token_endpoint_auth_methods_supported'),
idTokenSigningAlgValuesSupported: Arr::get($data, 'id_token_signing_alg_values_supported'),
subjectTypesSupported: Arr::get($data, 'subject_types_supported'),
codeChallengeMethodsSupported: Arr::get($data, 'code_challenge_methods_supported'),
scopesSupported: Arr::get($data, 'scopes_supported', []),
claimsSupported: Arr::get($data, 'claims_supported', []),
grantTypesSupported: Arr::get($data, 'grant_types_supported', []),
responseTypesSupported: Arr::get($data, 'response_types_supported', []),
responseModesSupported: Arr::get($data, 'response_modes_supported', []),
tokenEndpointAuthMethodsSupported: Arr::get($data, 'token_endpoint_auth_methods_supported', []),
idTokenSigningAlgValuesSupported: Arr::get($data, 'id_token_signing_alg_values_supported', []),
subjectTypesSupported: Arr::get($data, 'subject_types_supported', []),
codeChallengeMethodsSupported: Arr::get($data, 'code_challenge_methods_supported', []),
requestParameterSupported: Arr::get($data, 'request_parameter_supported'),
requestObjectSigningAlgValuesSupported: Arr::get($data, 'request_object_signing_alg_values_supported'),
promptValuesSupported: Arr::get($data, 'prompt_values_supported'),
requestObjectSigningAlgValuesSupported: Arr::get($data, 'request_object_signing_alg_values_supported', []),
promptValuesSupported: Arr::get($data, 'prompt_values_supported', []),
authorizationResponseIssParameterSupported: Arr::get($data, 'authorization_response_iss_parameter_supported'),
backchannelTokenDeliveryModesSupported: Arr::get($data, 'backchannel_token_delivery_modes_supported'),
backchannelTokenDeliveryModesSupported: Arr::get($data, 'backchannel_token_delivery_modes_supported', []),
backchannelUserCodeParameterSupported: Arr::get($data, 'backchannel_user_code_parameter_supported'),
dpopSigningAlgValuesSupported: Arr::get($data, 'dpop_signing_alg_values_supported'),
dpopSigningAlgValuesSupported: Arr::get($data, 'dpop_signing_alg_values_supported', []),
windowsAuthEndpoint: Arr::get($data, 'windows_auth_endpoint'),
);
}

public function __construct(
public string $issuer,
public string $jwksUri,
public string $authorizationEndpoint,
public string $tokenEndpoint,
public string $userinfoEndpoint,
public string $endSessionEndpoint,
public string $checkSessionIframe,
public string $revocationEndpoint,
public string $introspectionEndpoint,
public string $deviceAuthorizationEndpoint,
public string $backchannelAuthenticationEndpoint,
public string $pushedAuthorizationRequestEndpoint,
public bool $requirePushedAuthorizationRequests,
public bool $frontchannelLogoutSupported,
public bool $frontchannelLogoutSessionSupported,
public bool $backchannelLogoutSupported,
public bool $backchannelLogoutSessionSupported,
public ?string $issuer,
public ?string $jwksUri,
public ?string $authorizationEndpoint,
public ?string $tokenEndpoint,
public ?string $userinfoEndpoint,
public ?string $endSessionEndpoint,
public ?string $checkSessionIframe,
public ?string $revocationEndpoint,
public ?string $introspectionEndpoint,
public ?string $deviceAuthorizationEndpoint,
public ?string $backchannelAuthenticationEndpoint,
public ?string $pushedAuthorizationRequestEndpoint,
public ?bool $requirePushedAuthorizationRequests,
public ?bool $frontchannelLogoutSupported,
public ?bool $frontchannelLogoutSessionSupported,
public ?bool $backchannelLogoutSupported,
public ?bool $backchannelLogoutSessionSupported,
public array $scopesSupported,
public array $claimsSupported,
public array $grantTypesSupported,
Expand All @@ -73,13 +73,13 @@ public function __construct(
public array $idTokenSigningAlgValuesSupported,
public array $subjectTypesSupported,
public array $codeChallengeMethodsSupported,
public bool $requestParameterSupported,
public ?bool $requestParameterSupported,
public array $requestObjectSigningAlgValuesSupported,
public array $promptValuesSupported,
public bool $authorizationResponseIssParameterSupported,
public ?bool $authorizationResponseIssParameterSupported,
public array $backchannelTokenDeliveryModesSupported,
public bool $backchannelUserCodeParameterSupported,
public ?bool $backchannelUserCodeParameterSupported,
public array $dpopSigningAlgValuesSupported,
public string $windowsAuthEndpoint,
public ?string $windowsAuthEndpoint,
) {}
}
27 changes: 0 additions & 27 deletions src/DocuWare.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,8 @@

namespace CodebarAg\DocuWare;

use CodebarAg\DocuWare\DTO\Authentication\OAuth\RequestToken as RequestTokenDto;
use CodebarAg\DocuWare\Requests\Authentication\OAuth\GetIdentityServiceConfiguration;
use CodebarAg\DocuWare\Requests\Authentication\OAuth\GetResponsibleIdentityService;
use CodebarAg\DocuWare\Requests\Authentication\OAuth\RequestTokenWithCredentials;

class DocuWare
{
public function getNewAuthenticationOAuthToken(
?string $username = '',
?string $password = '',
?string $grantType = 'password',
?string $clientId = 'docuware.platform.net.client'
): RequestTokenDto {
$responsibleIdentityServiceResponse = (new GetResponsibleIdentityService)->send();

$identityServiceConfigurationResponse = (new GetIdentityServiceConfiguration(
identityServiceUrl: $responsibleIdentityServiceResponse->dto()->identityServiceUrl
))->send();

$requestTokenResponse = (new RequestTokenWithCredentials(
tokenEndpoint: $identityServiceConfigurationResponse->dto()->tokenEndpoint,
clientId: $clientId,
username: $username,
password: $password,
))->send();

return $requestTokenResponse->dto();
}

public function searchRequestBuilder(): DocuWareSearchRequestBuilder
{
return new DocuWareSearchRequestBuilder;
Expand Down

0 comments on commit 81b5220

Please sign in to comment.