Auth_OpenID_SRegRequest
extends Auth_OpenID_SRegBase
in package
An object to hold the state of a simple registration request.
required: A list of the required fields in this simple registration request
optional: A list of the optional fields in this simple registration request
Table of Contents
- $ns_alias : string
- $ns_uri : mixed
- ns_uri: The namespace to which to add the arguments for this extension
- $optional : array<string|int, mixed>
- $policy_url : string
- $required : array<string|int, mixed>
- _getSRegNS() : mixed|null|string
- Extract the simple registration namespace URI from the given OpenID message. Handles OpenID 1 and 2, as well as both sreg namespace URIs found in the wild, as well as missing namespace definitions (for OpenID 1)
- allRequestedFields() : mixed
- A list of all of the simple registration fields that were requested, whether they were required or optional.
- build() : null
- Initialize an empty simple registration request.
- contains() : bool
- Was this field in the request?
- fromOpenIDRequest() : Auth_OpenID_SRegRequest|null
- Create a simple registration request that contains the fields that were requested in the OpenID request with the given arguments
- getExtensionArgs() : array<string|int, mixed>|null
- Get a dictionary of unqualified simple registration arguments representing this request.
- parseExtensionArgs() : bool
- Parse the unqualified simple registration request parameters and add them to this object.
- requestField() : bool
- Request the specified field from the OpenID user
- requestFields() : bool
- Add the given list of fields to the request
- toMessage() : null
- Add the arguments from this extension to the provided message.
- wereFieldsRequested() : mixed
- Have any simple registration fields been requested?
Properties
$ns_alias
public
string
$ns_alias
= 'sreg'
$ns_uri
ns_uri: The namespace to which to add the arguments for this extension
public
mixed
$ns_uri
= \null
$optional
public
array<string|int, mixed>
$optional
= []
$policy_url
public
string
$policy_url
= ''
$required
public
array<string|int, mixed>
$required
= []
Methods
_getSRegNS()
Extract the simple registration namespace URI from the given OpenID message. Handles OpenID 1 and 2, as well as both sreg namespace URIs found in the wild, as well as missing namespace definitions (for OpenID 1)
public
static _getSRegNS(Auth_OpenID_Message $message) : mixed|null|string
$message: The OpenID message from which to parse simple registration fields. This may be a request or response message.
Returns the sreg namespace URI for the supplied message. The message may be modified to define a simple registration namespace.
Parameters
- $message : Auth_OpenID_Message
Tags
Return values
mixed|null|string —allRequestedFields()
A list of all of the simple registration fields that were requested, whether they were required or optional.
public
allRequestedFields() : mixed
Return values
mixed —build()
Initialize an empty simple registration request.
public
static build([null $required = null ][, null $optional = null ][, null $policy_url = null ][, string $sreg_ns_uri = Auth_OpenID_SREG_NS_URI ][, string $cls = 'Auth_OpenID_SRegRequest' ]) : null
Parameters
- $required : null = null
- $optional : null = null
- $policy_url : null = null
- $sreg_ns_uri : string = Auth_OpenID_SREG_NS_URI
- $cls : string = 'Auth_OpenID_SRegRequest'
Return values
null —contains()
Was this field in the request?
public
contains(string $field_name) : bool
Parameters
- $field_name : string
Return values
bool —fromOpenIDRequest()
Create a simple registration request that contains the fields that were requested in the OpenID request with the given arguments
public
static fromOpenIDRequest(Auth_OpenID_Request $request[, string $cls = 'Auth_OpenID_SRegRequest' ]) : Auth_OpenID_SRegRequest|null
$request: The OpenID authentication request from which to extract an sreg request.
$cls: name of class to use when creating sreg request object. Used for testing.
Returns the newly created simple registration request
Parameters
- $request : Auth_OpenID_Request
- $cls : string = 'Auth_OpenID_SRegRequest'
Return values
Auth_OpenID_SRegRequest|null —getExtensionArgs()
Get a dictionary of unqualified simple registration arguments representing this request.
public
getExtensionArgs([Auth_OpenID_Request|null $request = null ]) : array<string|int, mixed>|null
This method is essentially the inverse of C{L{parseExtensionArgs}}. This method serializes the simple registration request fields.
Parameters
- $request : Auth_OpenID_Request|null = null
Return values
array<string|int, mixed>|null —parseExtensionArgs()
Parse the unqualified simple registration request parameters and add them to this object.
public
parseExtensionArgs(array<string|int, mixed> $args[, bool $strict = false ]) : bool
This method is essentially the inverse of getExtensionArgs. This method restores the serialized simple registration request fields.
If you are extracting arguments from a standard OpenID checkid_* request, you probably want to use fromOpenIDRequest, which will extract the sreg namespace and arguments from the OpenID request. This method is intended for cases where the OpenID server needs more control over how the arguments are parsed than that method provides.
$args == $message->getArgs($ns_uri); $request->parseExtensionArgs($args);
$args: The unqualified simple registration arguments
strict: Whether requests with fields that are not defined in the simple registration specification should be tolerated (and ignored)
Parameters
- $args : array<string|int, mixed>
- $strict : bool = false
Return values
bool —requestField()
Request the specified field from the OpenID user
public
requestField(string $field_name[, bool $required = false ][, bool $strict = false ]) : bool
$field_name: the unqualified simple registration field name
required: whether the given field should be presented to the user as being a required to successfully complete the request
strict: whether to raise an exception when a field is added to a request more than once
Parameters
- $field_name : string
- $required : bool = false
- $strict : bool = false
Return values
bool —requestFields()
Add the given list of fields to the request
public
requestFields(string $field_names[, bool $required = false ][, bool $strict = false ]) : bool
field_names: The simple registration data fields to request
required: Whether these values should be presented to the user as required
strict: whether to raise an exception when a field is added to a request more than once
Parameters
- $field_names : string
- $required : bool = false
- $strict : bool = false
Return values
bool —toMessage()
Add the arguments from this extension to the provided message.
public
toMessage(Auth_OpenID_Message $message[, Auth_OpenID_Request $request = null ]) : null
Returns the message with the extension arguments added.
Parameters
- $message : Auth_OpenID_Message
- $request : Auth_OpenID_Request = null
Return values
null —wereFieldsRequested()
Have any simple registration fields been requested?
public
wereFieldsRequested() : mixed