Skip to content

Commit

Permalink
Backport to php 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricverhaeghe committed Feb 22, 2018
1 parent 44447a7 commit 92eea18
Show file tree
Hide file tree
Showing 49 changed files with 95 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function doExecute(AssertionContext $context)
);

/** @var RequestStateContext $requestStateContext */
$requestStateContext = $context->getSubContext(ProfileContexts::REQUEST_STATE, RequestStateContext::class);
$requestStateContext = $context->getSubContext(ProfileContexts::REQUEST_STATE, RequestStateContext::CLASSNAME);
$requestStateContext->setRequestState($requestState);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ protected function validateSubjectConfirmation(AssertionContext $context, Subjec
}

$criteriaSet = new CriteriaSet([
new DescriptorTypeCriteria(SpSsoDescriptor::class),
new ServiceTypeCriteria(AssertionConsumerService::class),
new DescriptorTypeCriteria(SpSsoDescriptor::CLASSNAME),
new ServiceTypeCriteria(AssertionConsumerService::CLASSNAME),
new LocationCriteria($recipient),
]);
$ownEntityDescriptor = $context->getProfileContext()->getOwnEntityDescriptor();
Expand Down
2 changes: 1 addition & 1 deletion src/LightSaml/Action/CatchableErrorAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function execute(ContextInterface $context)
$this->mainAction->execute($context);
} catch (\Exception $ex) {
/** @var ExceptionContext $exceptionContext */
$exceptionContext = $context->getSubContext(ProfileContexts::EXCEPTION, ExceptionContext::class);
$exceptionContext = $context->getSubContext(ProfileContexts::EXCEPTION, ExceptionContext::CLASSNAME);
$exceptionContext->addException($ex);

$this->errorAction->execute($context);
Expand Down
4 changes: 3 additions & 1 deletion src/LightSaml/Action/CompositeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

class CompositeAction implements ActionInterface, DebugPrintTreeActionInterface, CompositeActionInterface
{
const CLASSNAME = __CLASS__;

/** @var ActionInterface[] */
protected $children = array();

Expand Down Expand Up @@ -90,7 +92,7 @@ public function debugPrintTree()
}

$result = array(
static::class => $arr,
static::CLASSNAME => $arr,
);

return $result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function doExecute(ProfileContext $context)
$ownEntityDescriptor = $context->getOwnEntityDescriptor();

/** @var SerializationContext $serializationContext */
$serializationContext = $context->getSubContext(ProfileContexts::SERIALIZATION, SerializationContext::class);
$serializationContext = $context->getSubContext(ProfileContexts::SERIALIZATION, SerializationContext::CLASSNAME);
$serializationContext->getDocument()->formatOutput = true;

$ownEntityDescriptor->serialize($serializationContext->getDocument(), $serializationContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ protected function getCriteriaSet(ProfileContext $context, $location)
$criteriaSet = new CriteriaSet([
new DescriptorTypeCriteria(
$context->getOwnRole() === ProfileContext::ROLE_IDP
? IdpSsoDescriptor::class
: SpSsoDescriptor::class
? IdpSsoDescriptor::CLASSNAME
: SpSsoDescriptor::CLASSNAME
),
new LocationCriteria($location),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function getCriteriaSet(ProfileContext $context, $location)
{
$result = parent::getCriteriaSet($context, $location);

$result->add(new ServiceTypeCriteria(SingleSignOnService::class));
$result->add(new ServiceTypeCriteria(SingleSignOnService::CLASSNAME));

return $result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function getCriteriaSet(ProfileContext $context, $location)
{
$result = parent::getCriteriaSet($context, $location);

$result->add(new ServiceTypeCriteria(AssertionConsumerService::class));
$result->add(new ServiceTypeCriteria(AssertionConsumerService::CLASSNAME));

return $result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

class AssertionAction extends AbstractProfileAction implements DebugPrintTreeActionInterface
{
const CLASSNAME = __CLASS__;

/** @var ActionInterface */
private $assertionAction;

Expand All @@ -45,7 +47,7 @@ protected function doExecute(ProfileContext $context)
foreach ($response->getAllAssertions() as $index => $assertion) {
$name = sprintf('assertion_%s', $index);
/** @var AssertionContext $assertionContext */
$assertionContext = $context->getSubContext($name, AssertionContext::class);
$assertionContext = $context->getSubContext($name, AssertionContext::CLASSNAME);
$assertionContext
->setAssertion($assertion)
->setId($name)
Expand All @@ -70,7 +72,7 @@ public function debugPrintTree($depth = 0)
}

$result = array(
static::class => $arr,
static::CLASSNAME => $arr,
);

return $result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function doExecute(ProfileContext $context)
if ($encryptedAssertion instanceof EncryptedAssertionReader) {
$name = sprintf('assertion_encrypted_%s', $index);
/** @var DeserializationContext $deserializationContext */
$deserializationContext = $context->getInboundContext()->getSubContext($name, DeserializationContext::class);
$deserializationContext = $context->getInboundContext()->getSubContext($name, DeserializationContext::CLASSNAME);
$assertion = $encryptedAssertion->decryptMultiAssertion($privateKeys, $deserializationContext);
$response->addAssertion($assertion);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function doExecute(ProfileContext $context)
}

/** @var RequestStateContext $requestStateContext */
$requestStateContext = $context->getInboundContext()->getSubContext(ProfileContexts::REQUEST_STATE, RequestStateContext::class);
$requestStateContext = $context->getInboundContext()->getSubContext(ProfileContexts::REQUEST_STATE, RequestStateContext::CLASSNAME);
$requestStateContext->setRequestState($requestState);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ protected function doExecute(ProfileContext $context)
$ownEntityDescriptor = $context->getOwnEntityDescriptor();

$criteriaSet = new CriteriaSet([
new DescriptorTypeCriteria(SpSsoDescriptor::class),
new ServiceTypeCriteria(AssertionConsumerService::class),
new DescriptorTypeCriteria(SpSsoDescriptor::CLASSNAME),
new ServiceTypeCriteria(AssertionConsumerService::CLASSNAME),
new BindingCriteria([SamlConstants::BINDING_SAML2_HTTP_POST]),
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ protected function getBindings(ProfileContext $context)
protected function getDescriptorType(ProfileContext $context)
{
return $context->getOwnRole() == ProfileContext::ROLE_IDP
? SpSsoDescriptor::class
: IdpSsoDescriptor::class;
? SpSsoDescriptor::CLASSNAME
: IdpSsoDescriptor::CLASSNAME;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ class ResolveEndpointIdpSsoAction extends ResolveEndpointBaseAction
{
protected function getServiceType(ProfileContext $context)
{
return SingleSignOnService::class;
return SingleSignOnService::CLASSNAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ResolveEndpointSloAction extends ResolveEndpointBaseAction
{
protected function getServiceType(ProfileContext $context)
{
return SingleLogoutService::class;
return SingleLogoutService::CLASSNAME;
}

protected function getDescriptorType(ProfileContext $context)
Expand All @@ -30,9 +30,9 @@ protected function getDescriptorType(ProfileContext $context)
$ownEntityId = $context->getOwnEntityDescriptor()->getEntityID();

if ($ssoSessionState->getIdpEntityId() == $ownEntityId) {
return SpSsoDescriptor::class;
return SpSsoDescriptor::CLASSNAME;
} elseif ($ssoSessionState->getSpEntityId() == $ownEntityId) {
return IdpSsoDescriptor::class;
return IdpSsoDescriptor::CLASSNAME;
} else {
throw new LightSamlContextException($context, 'Unable to resolve logout target descriptor type');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ class ResolveEndpointSpAcsAction extends ResolveEndpointBaseAction
{
protected function getServiceType(ProfileContext $context)
{
return AssertionConsumerService::class;
return AssertionConsumerService::CLASSNAME;
}
}
4 changes: 3 additions & 1 deletion src/LightSaml/Context/AbstractContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

abstract class AbstractContext implements ContextInterface
{
const CLASSNAME = __CLASS__;

/** @var ContextInterface|null */
private $parent;

Expand Down Expand Up @@ -169,7 +171,7 @@ public function getIterator()
public function debugPrintTree($ownName = 'root')
{
$result = array(
$ownName => static::class,
$ownName => static::CLASSNAME,
);

if ($this->subContexts) {
Expand Down
4 changes: 2 additions & 2 deletions src/LightSaml/Context/Profile/MessageContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ public function asLogoutResponse()
*/
public function getSerializationContext()
{
return $this->getSubContext(ProfileContexts::SERIALIZATION, SerializationContext::class);
return $this->getSubContext(ProfileContexts::SERIALIZATION, SerializationContext::CLASSNAME);
}

/**
* @return DeserializationContext
*/
public function getDeserializationContext()
{
return $this->getSubContext(ProfileContexts::DESERIALIZATION, DeserializationContext::class);
return $this->getSubContext(ProfileContexts::DESERIALIZATION, DeserializationContext::CLASSNAME);
}
}
16 changes: 8 additions & 8 deletions src/LightSaml/Context/Profile/ProfileContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,63 +79,63 @@ public function setRelayState($relayState)
*/
public function getInboundContext()
{
return $this->getSubContext(ProfileContexts::INBOUND_MESSAGE, MessageContext::class);
return $this->getSubContext(ProfileContexts::INBOUND_MESSAGE, MessageContext::CLASSNAME);
}

/**
* @return MessageContext
*/
public function getOutboundContext()
{
return $this->getSubContext(ProfileContexts::OUTBOUND_MESSAGE, MessageContext::class);
return $this->getSubContext(ProfileContexts::OUTBOUND_MESSAGE, MessageContext::CLASSNAME);
}

/**
* @return HttpRequestContext
*/
public function getHttpRequestContext()
{
return $this->getSubContext(ProfileContexts::HTTP_REQUEST, HttpRequestContext::class);
return $this->getSubContext(ProfileContexts::HTTP_REQUEST, HttpRequestContext::CLASSNAME);
}

/**
* @return HttpResponseContext
*/
public function getHttpResponseContext()
{
return $this->getSubContext(ProfileContexts::HTTP_RESPONSE, HttpResponseContext::class);
return $this->getSubContext(ProfileContexts::HTTP_RESPONSE, HttpResponseContext::CLASSNAME);
}

/**
* @return EntityContext
*/
public function getOwnEntityContext()
{
return $this->getSubContext(ProfileContexts::OWN_ENTITY, EntityContext::class);
return $this->getSubContext(ProfileContexts::OWN_ENTITY, EntityContext::CLASSNAME);
}

/**
* @return EntityContext
*/
public function getPartyEntityContext()
{
return $this->getSubContext(ProfileContexts::PARTY_ENTITY, EntityContext::class);
return $this->getSubContext(ProfileContexts::PARTY_ENTITY, EntityContext::CLASSNAME);
}

/**
* @return EndpointContext
*/
public function getEndpointContext()
{
return $this->getSubContext(ProfileContexts::ENDPOINT, EndpointContext::class);
return $this->getSubContext(ProfileContexts::ENDPOINT, EndpointContext::CLASSNAME);
}

/**
* @return LogoutContext
*/
public function getLogoutContext()
{
return $this->getSubContext(ProfileContexts::LOGOUT, LogoutContext::class);
return $this->getSubContext(ProfileContexts::LOGOUT, LogoutContext::CLASSNAME);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

class MetadataCredentialContext implements CredentialContextInterface
{
const CLASSNAME = __CLASS__;

/** @var KeyDescriptor */
protected $keyDescriptor;

Expand Down
2 changes: 2 additions & 0 deletions src/LightSaml/Credential/Criteria/AlgorithmCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

class AlgorithmCriteria implements TrustCriteriaInterface
{
const CLASSNAME = __CLASS__;

/** @var string */
protected $algorithm;

Expand Down
2 changes: 2 additions & 0 deletions src/LightSaml/Credential/Criteria/CredentialNameCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

class CredentialNameCriteria implements TrustCriteriaInterface
{
const CLASSNAME = __CLASS__;

/** @var string */
protected $name;

Expand Down
2 changes: 2 additions & 0 deletions src/LightSaml/Credential/Criteria/EntityIdCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

class EntityIdCriteria implements TrustCriteriaInterface
{
const CLASSNAME = __CLASS__;

/** @var string */
protected $entityId;

Expand Down
1 change: 1 addition & 0 deletions src/LightSaml/Credential/Criteria/MetadataCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

class MetadataCriteria implements TrustCriteriaInterface
{
const CLASSNAME = __CLASS__;
const TYPE_IDP = 'idp';
const TYPE_SP = 'sp';

Expand Down
1 change: 1 addition & 0 deletions src/LightSaml/Credential/Criteria/PrivateKeyCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@

class PrivateKeyCriteria implements TrustCriteriaInterface
{
const CLASSNAME = __CLASS__;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

class PublicKeyThumbprintCriteria implements TrustCriteriaInterface
{
const CLASSNAME = __CLASS__;

/** @var string */
private $thumbprint;

Expand Down
2 changes: 2 additions & 0 deletions src/LightSaml/Credential/Criteria/UsageCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

class UsageCriteria implements TrustCriteriaInterface
{
const CLASSNAME = __CLASS__;

/** @var string */
protected $usage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@

class X509CredentialCriteria implements TrustCriteriaInterface
{
const CLASSNAME = __CLASS__;
}
2 changes: 2 additions & 0 deletions src/LightSaml/Model/AbstractSamlModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

abstract class AbstractSamlModel implements SamlElementInterface
{
const CLASSNAME = __CLASS__;

/**
* @param string $name
* @param null|string $namespace
Expand Down
2 changes: 2 additions & 0 deletions src/LightSaml/Model/Context/DeserializationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

class DeserializationContext
{
const CLASSNAME = __CLASS__;

/** @var \DOMDocument */
private $document;

Expand Down
2 changes: 2 additions & 0 deletions src/LightSaml/Model/Context/SerializationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

class SerializationContext
{
const CLASSNAME = __CLASS__;

/** @var \DOMDocument */
protected $document;

Expand Down
Loading

0 comments on commit 92eea18

Please sign in to comment.