1 | <?php |
||
11 | final class NameIdFormat implements Serializable |
||
12 | { |
||
13 | /** |
||
14 | * The various types of Name Identifier Format Identifiers as defined in section 8.3 of |
||
15 | * Assertions and Protocols for the OASIS Security Assertion Markup Language (SAML) V2.0 |
||
16 | * |
||
17 | * @see https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf |
||
18 | */ |
||
19 | const UNSPECIFIED = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'; |
||
20 | const EMAIL_ADDRESS = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'; |
||
21 | const X509_SUBJECT_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName'; |
||
22 | const WINDOWS_DOMAIN_QUALIFIED_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName'; |
||
23 | const KERBEROS_PRINCIPLE_NAME = 'urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos'; |
||
24 | const ENTITY_IDENTIFIER = 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity'; |
||
25 | const PERSISTENT_IDENTIFIER = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'; |
||
26 | const TRANSIENT_IDENTIFIER = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private static $validFormats = array( |
||
32 | self::UNSPECIFIED, |
||
33 | self::EMAIL_ADDRESS, |
||
34 | self::X509_SUBJECT_NAME, |
||
35 | self::WINDOWS_DOMAIN_QUALIFIED_NAME, |
||
36 | self::KERBEROS_PRINCIPLE_NAME, |
||
37 | self::ENTITY_IDENTIFIER, |
||
38 | self::PERSISTENT_IDENTIFIER, |
||
39 | self::TRANSIENT_IDENTIFIER |
||
40 | ); |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | private $format; |
||
46 | |||
47 | /** |
||
48 | ** @param string $format one of the valid NameID formats |
||
49 | */ |
||
50 | public function __construct($format) |
||
56 | |||
57 | /** |
||
58 | * @return NameIdFormat |
||
59 | */ |
||
60 | public static function unspecified() |
||
64 | |||
65 | /** |
||
66 | * @return NameIdFormat |
||
67 | */ |
||
68 | public static function emailAddress() |
||
72 | |||
73 | /** |
||
74 | * @return NameIdFormat |
||
75 | */ |
||
76 | public static function x509SubjectName() |
||
80 | |||
81 | /** |
||
82 | * @return NameIdFormat |
||
83 | */ |
||
84 | public static function windowsDomainQualifiedName() |
||
88 | |||
89 | /** |
||
90 | * @return NameIdFormat |
||
91 | */ |
||
92 | public static function kerberosPrincipalName() |
||
96 | |||
97 | /** |
||
98 | * @return NameIdFormat |
||
99 | */ |
||
100 | public static function entity() |
||
104 | |||
105 | /** |
||
106 | * @return NameIdFormat |
||
107 | */ |
||
108 | public static function persistent() |
||
112 | |||
113 | /** |
||
114 | * @return NameIdFormat |
||
115 | */ |
||
116 | public static function transient() |
||
120 | |||
121 | /** |
||
122 | * @param NameIdFormat $other |
||
123 | * @return bool |
||
124 | */ |
||
125 | public function equals(NameIdFormat $other) |
||
129 | |||
130 | /** |
||
131 | * @return string |
||
132 | */ |
||
133 | public function getFormat() |
||
137 | |||
138 | public static function deserialize($data) |
||
144 | |||
145 | public function serialize() |
||
149 | |||
150 | public function __toString() |
||
154 | } |
||
155 |