File tree 4 files changed +62
-0
lines changed
4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -27,10 +27,22 @@ function doIncludes() {
27
27
* Require the Simple Registration extension API.
28
28
*/
29
29
require_once "Auth/OpenID/SReg.php " ;
30
+
31
+ /**
32
+ * Require the PAPE extension module.
33
+ */
34
+ require_once "Auth/OpenID/PAPE.php " ;
30
35
}
31
36
32
37
doIncludes ();
33
38
39
+ global $ pape_policy_uris ;
40
+ $ pape_policy_uris = array (
41
+ PAPE_AUTH_MULTI_FACTOR_PHYSICAL ,
42
+ PAPE_AUTH_MULTI_FACTOR ,
43
+ PAPE_AUTH_PHISHING_RESISTANT
44
+ );
45
+
34
46
function &getStore () {
35
47
/**
36
48
* This is where the example will store its OpenID information.
Original file line number Diff line number Diff line change @@ -48,6 +48,35 @@ function run() {
48
48
if (@$ sreg ['fullname ' ]) {
49
49
$ success .= " Your fullname is ' " .$ sreg ['fullname ' ]."'. " ;
50
50
}
51
+
52
+ $ pape_resp = Auth_OpenID_PAPE_Response::fromSuccessResponse ($ response );
53
+
54
+ if ($ pape_resp ) {
55
+ if ($ pape_resp ->auth_policies ) {
56
+ $ success .= "<p>The following PAPE policies affected the authentication:</p><ul> " ;
57
+
58
+ foreach ($ pape_resp ->auth_policies as $ uri ) {
59
+ $ success .= "<li><tt> $ uri</tt></li> " ;
60
+ }
61
+
62
+ $ success .= "</ul> " ;
63
+ } else {
64
+ $ success .= "<p>No PAPE policies affected the authentication.</p> " ;
65
+ }
66
+
67
+ if ($ pape_resp ->auth_age ) {
68
+ $ success .= "<p>The authentication age returned by the " .
69
+ "server is: <tt> " .$ pape_resp ->auth_age ."</tt></p> " ;
70
+ }
71
+
72
+ if ($ pape_resp ->nist_auth_level ) {
73
+ $ success .= "<p>The NIST auth level returned by the " .
74
+ "server is: <tt> " .$ pape_resp ->nist_auth_level ."</tt></p> " ;
75
+ }
76
+
77
+ } else {
78
+ $ success .= "<p>No PAPE response was sent by the provider.</p> " ;
79
+ }
51
80
}
52
81
53
82
include 'index.php ' ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ require_once "common.php " ;
3
+
4
+ global $ pape_policy_uris ;
5
+ ?>
1
6
<html>
2
7
<head><title>PHP OpenID Authentication Example</title></head>
3
8
<style type="text/css">
52
57
Identity URL:
53
58
<input type="hidden" name="action" value="verify" />
54
59
<input type="text" name="openid_identifier" value="" />
60
+
61
+ <p>Optionally, request these PAPE policies:</p>
62
+ <p>
63
+ <?php foreach ($ pape_policy_uris as $ i => $ uri ) {
64
+ print "<input type= \"checkbox \" name= \"policies[] \" value= \"$ uri \" /> " ;
65
+ print "$ uri<br/> " ;
66
+ } ?>
67
+ </p>
68
+
55
69
<input type="submit" value="Verify" />
56
70
</form>
57
71
</div>
Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ function run() {
37
37
$ auth_request ->addExtension ($ sreg_request );
38
38
}
39
39
40
+ $ policy_uris = $ _GET ['policies ' ];
41
+
42
+ $ pape_request = new Auth_OpenID_PAPE_Request ($ policy_uris );
43
+ if ($ pape_request ) {
44
+ $ auth_request ->addExtension ($ pape_request );
45
+ }
46
+
40
47
// Redirect the user to the OpenID server for authentication.
41
48
// Store the token for this authentication so we can verify the
42
49
// response.
You can’t perform that action at this time.
0 commit comments