From 87b096d557e9e882dd4e8a5b38088d2cdbb0e6ce Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 01:36:22 +0800 Subject: [PATCH 01/10] Update openid.php Disable magic_quotes_gpc checking for unsupported by PHP 7.4 --- openid.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openid.php b/openid.php index 14e684b..359f3aa 100644 --- a/openid.php +++ b/openid.php @@ -917,8 +917,9 @@ function validate() # In such case, validation would fail, since we'd send different data than OP # wants to verify. stripslashes() should solve that problem, but we can't # use it when magic_quotes is off. - $value = $this->data['openid_' . str_replace('.','_',$item)]; - $params['openid.' . $item] = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() ? stripslashes($value) : $value; + + ## Disable magic_quotes_gpc checking + $params['openid.' . $item] = $this->data['openid_' . str_replace('.','_',$item)]; } From bb7faaf948dd9b96f42878701ca5340011ff45cf Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 01:52:31 +0800 Subject: [PATCH 02/10] add: Ntpc OpenId --- NtpcOpenId.php | 215 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 NtpcOpenId.php diff --git a/NtpcOpenId.php b/NtpcOpenId.php new file mode 100644 index 0000000..2536cc6 --- /dev/null +++ b/NtpcOpenId.php @@ -0,0 +1,215 @@ +getAttributes(); + $tmp = explode('/', $this->identity); + $ntpcAttr['account'] = end($tmp); // 帳號 + $ntpcAttr['cname'] = $attr['namePerson']; // 姓名 + $ntpcAttr['gender'] = $attr['person/gender']; // 性別 + $ntpcAttr['birth'] = $attr['birthDate']; // 生日 + $ntpcAttr['email'] = $attr['contact/email']; // 公務信箱 + $ntpcAttr['school_title'] = $attr['contact/country/home']; // 學校簡稱 + $ntpcAttr['grade'] = substr($attr['pref/language'], 0, 2); // 年級 + $ntpcAttr['class'] = substr($attr['pref/language'], 2, 2); // 班級 + $ntpcAttr['class_no'] = substr($attr['pref/language'], 4, 2); // 座號 + + foreach (json_decode($attr['pref/timezone']) as $item) { + $ntpcAttr['workplaces'][$item->id]['school_title'] = $item->name; // 單位全銜 + $ntpcAttr['workplaces'][$item->id]['role'] = $item->role; // 身分別 + $ntpcAttr['workplaces'][$item->id]['title'] = $item->title; // 職稱別 + $ntpcAttr['workplaces'][$item->id]['groups'] = $item->groups; // 職務別 + $ntpcAttr['workplaces'][$item->id]['groups_string'] = $item->groups; // 職務別 + } + return $ntpcAttr; + } + + /** + * 驗證 + * + * @return boolean + */ + public function validate() + { + $ret = parent::validate(); + if ($ret) { + $this->ntpcData = $this->getNtpcAttributes(); + } + return $ret; + } + + /** + * 傳回Ntpc OpenID Data + * + * @return array + */ + public function getNtpcData() + { + return $this->ntpcData; + } + + /** + * 是否具備身份 + * + * @param string $role + * @return boolean + */ + public function hasRole($role) + { + $ret = false; + if (count($this->allowed_school_ids)) { + foreach ( + $this->ntpcData['workplaces'] + as $school_id => $workplace + ) { + foreach ($this->allowed_school_ids as $allow_school_id) { + if ( + $school_id == $allow_school_id and + $workplace['role'] == $role + ) { + $ret = true; + } + } + } + } else { + foreach ( + $this->ntpcData['workplaces'] + as $school_id => $workplace + ) { + if ($workplace['role'] == $role) { + $ret = true; + } + } + } + return $ret; + } + + /** + * 是否具備職稱 + * + * @param string $title + * @return boolean + */ + public function hasTitle($title) + { + $ret = false; + if (count($this->allowed_school_ids)) { + foreach ( + $this->ntpcData['workplaces'] + as $school_id => $workplace + ) { + foreach ($this->allowed_school_ids as $allow_school_id) { + if ( + $school_id == $allow_school_id and + $title == $workplace['title'] + ) { + $ret = true; + } + } + } + } else { + foreach ( + $this->ntpcData['workplaces'] + as $school_id => $workplace + ) { + if ($title == $workplace['title']) { + $ret = true; + } + } + } + return $ret; + } + + /** + * 是否具備職務 + * + * @param string $group + * @return boolean + */ + public function hasGroup($group) + { + $ret = false; + if (count($this->allowed_school_ids)) { + foreach ( + $this->ntpcData['workplaces'] + as $school_id => $workplace + ) { + foreach ($this->allowed_school_ids as $allow_school_id) { + if ( + $school_id == $allow_school_id and + in_array($group, $workplace['groups']) + ) { + $ret = true; + } + } + } + } else { + foreach ( + $this->ntpcData['workplaces'] + as $school_id => $workplace + ) { + if (in_array($group, $workplace['groups'])) { + $ret = true; + } + } + } + return $ret; + } + + public function setAllowedSchool($Ids) + { + if (gettype($Ids) == "array") { + $this->allowed_school_ids = $Ids; + } elseif (gettype($Ids) == "string") { + $this->allowed_school_ids = [$Ids]; + } + } + + public function setRequried($required_type = 1) + { + if ($required_type === 2) { + $this->required = [ + 'namePerson/friendly', + 'contact/email', + 'namePerson', + 'birthDate', + 'person/gender', + 'contact/postalCode/home', + 'contact/country/home', + 'pref/language', + 'pref/timezone', + ]; + } else { + $this->required = [ + 'contact/email', + 'namePerson', + 'contact/country/home', + 'pref/timezone', + 'pref/language', + ]; + } + } + + public function is_officer(){ + + } + + public function is_admin(){ + + } +} From 24fe5e8797f7768fd32e87702e2e511738e3ec9f Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 12:36:03 +0800 Subject: [PATCH 03/10] add: default reqired fields, and auto assigned ntpcData --- NtpcOpenId.php | 83 ++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/NtpcOpenId.php b/NtpcOpenId.php index 2536cc6..0413d16 100644 --- a/NtpcOpenId.php +++ b/NtpcOpenId.php @@ -8,6 +8,8 @@ class NtpcOpenId extends LightOpenId public function __construct($host) { parent::__construct($host); + $this->identity = "https://openid.ntpc.edu.tw/"; + $this->setRequried(); } /** @@ -20,22 +22,31 @@ public function getNtpcAttributes() $attr = $this->getAttributes(); $tmp = explode('/', $this->identity); $ntpcAttr['account'] = end($tmp); // 帳號 - $ntpcAttr['cname'] = $attr['namePerson']; // 姓名 - $ntpcAttr['gender'] = $attr['person/gender']; // 性別 - $ntpcAttr['birth'] = $attr['birthDate']; // 生日 - $ntpcAttr['email'] = $attr['contact/email']; // 公務信箱 - $ntpcAttr['school_title'] = $attr['contact/country/home']; // 學校簡稱 - $ntpcAttr['grade'] = substr($attr['pref/language'], 0, 2); // 年級 - $ntpcAttr['class'] = substr($attr['pref/language'], 2, 2); // 班級 - $ntpcAttr['class_no'] = substr($attr['pref/language'], 4, 2); // 座號 - foreach (json_decode($attr['pref/timezone']) as $item) { - $ntpcAttr['workplaces'][$item->id]['school_title'] = $item->name; // 單位全銜 - $ntpcAttr['workplaces'][$item->id]['role'] = $item->role; // 身分別 - $ntpcAttr['workplaces'][$item->id]['title'] = $item->title; // 職稱別 - $ntpcAttr['workplaces'][$item->id]['groups'] = $item->groups; // 職務別 - $ntpcAttr['workplaces'][$item->id]['groups_string'] = $item->groups; // 職務別 + foreach($this->required as $field_name => $field_value){ + + switch($field_name){ + case 'class_info': + $ntpcAttr['grade'] = substr($attr['pref/language'], 0, 2); // 年級 + $ntpcAttr['class'] = substr($attr['pref/language'], 2, 2); // 班級 + $ntpcAttr['class_no'] = substr($attr['pref/language'], 4, 2); // 座號 + break; + case 'permission_info': + foreach (json_decode($attr['pref/timezone']) as $item) { + $ntpcAttr['workplaces'][$item->id]['school_title'] = + $item->name; // 單位全銜 + $ntpcAttr['workplaces'][$item->id]['role'] = $item->role; // 身分別 + $ntpcAttr['workplaces'][$item->id]['title'] = $item->title; // 職稱別 + $ntpcAttr['workplaces'][$item->id]['groups'] = $item->groups; // 職務別 + $ntpcAttr['workplaces'][$item->id]['groups_string'] = + $item->groups; // 職務別 + } + break; + default: + $ntpcAttr[$field_name] = $field_value; + } } + return $ntpcAttr; } @@ -180,36 +191,28 @@ public function setAllowedSchool($Ids) } } - public function setRequried($required_type = 1) + public function setRequried($required_type = 0) { - if ($required_type === 2) { + if ($required_type) { $this->required = [ - 'namePerson/friendly', - 'contact/email', - 'namePerson', - 'birthDate', - 'person/gender', - 'contact/postalCode/home', - 'contact/country/home', - 'pref/language', - 'pref/timezone', + 'nickname' => 'namePerson/friendly', + 'email' => 'contact/email', + 'cname' => 'namePerson', + 'birth' => 'birthDate', + 'gender' => 'person/gender', + 'identity_code' => 'contact/postalCode/home', + 'school_title' => 'contact/country/home', + 'class_info' => 'pref/language', + 'permission_info' => 'pref/timezone', ]; } else { $this->required = [ - 'contact/email', - 'namePerson', - 'contact/country/home', - 'pref/timezone', - 'pref/language', - ]; + 'email' => 'contact/email', + 'cname' => 'namePerson', + 'school_title' => 'contact/country/home', + 'class_info' => 'pref/language', + 'permission_info' => 'pref/timezone', + ]; } } - - public function is_officer(){ - - } - - public function is_admin(){ - - } -} +} \ No newline at end of file From 32864c3531611f126330bcfaa69ccba963b8cc07 Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 14:20:38 +0800 Subject: [PATCH 04/10] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=8F=96?= =?UTF-8?q?=E5=9B=9E=20Ntpc=20Data=E7=9A=84=E5=80=BC,=20getNtpcAttributes(?= =?UTF-8?q?)=20=E4=BF=AE=E6=AD=A3=E7=82=BA=20private?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NtpcOpenId.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NtpcOpenId.php b/NtpcOpenId.php index 0413d16..001632e 100644 --- a/NtpcOpenId.php +++ b/NtpcOpenId.php @@ -17,7 +17,7 @@ public function __construct($host) * * @return void */ - public function getNtpcAttributes() + private function getNtpcAttributes() { $attr = $this->getAttributes(); $tmp = explode('/', $this->identity); @@ -43,7 +43,7 @@ public function getNtpcAttributes() } break; default: - $ntpcAttr[$field_name] = $field_value; + $ntpcAttr[$field_name] = $attr[$field_value]; } } From 1aaa0a09d0a27a868a9b4589d39070340b756d83 Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 14:20:56 +0800 Subject: [PATCH 05/10] change: README --- README.md | 133 ++++++++++++++++++++++++------------------------------ 1 file changed, 59 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 3dc0a81..0caec7f 100644 --- a/README.md +++ b/README.md @@ -1,110 +1,95 @@ > **NOTICE** -> I am no longer able to support or maintain this project - if you would like to take over the project, please drop me a line. +> This project is forked from github.com/iignatov/LightOpenID. Extending for Ntpc OpenID service and add a litte auto settings. It must run with openid.php together. + +# NtpcOpenID + +NtpcOpenID library for easy Ntpc OpenID Authentication and Auhtorization. + +- `Version....:` [**0.1**] +- `Source code:` [Official GitHub Repo :octocat:][5] +- `Author.....:` [Tiebob] # LightOpenID Lightweight PHP5 library for easy OpenID authentication. -* `Version....:` [**1.3.1** :arrow_double_down:][1] - ( *see [the change log][2] for details* ) -* `Released on:` March 04, 2016 -* `Source code:` [Official GitHub Repo :octocat:][3] -* `Homepage...:` http://code.google.com/p/lightopenid/ -* `Author.....:` [Mewp][4] +- `Version....:` [**1.3.1** :arrow_double_down:][1] + ( _see [the change log][2] for details_ ) +- `Released on:` March 04, 2016 +- `Source code:` [Official GitHub Repo :octocat:][3] +- `Homepage...:` http://code.google.com/p/lightopenid/ +- `Author.....:` [Mewp][4] [1]: https://github.com/iignatov/LightOpenID/archive/master.zip [2]: https://github.com/iignatov/LightOpenID/blob/master/CHANGELOG.md [3]: https://github.com/Mewp/lightopenid [4]: https://github.com/Mewp - +[5]: https://github.com/Tiebob/LightOpenID/archive/master.zip ## Quick start -### Add to composer.json +### Download openid.php and NtpcOpenID.php from github repo above. + +### Sign-on with OpenID in just 2 steps: + +1. Authentication with the provider: + + ```php + $openid = new LightOpenID('my-host.example.org'); + + header('Location: ' . $openid->authUrl()); + ``` + +2. Verification: -```javascript -"repositories": [ - { - "type": "vcs", - "url": "https://github.com/iignatov/LightOpenID" - } -], + ```php + $openid = new LightOpenID('my-host.example.org'); -"require": { - "php": ">=5.4.0", - "iignatov/lightopenid": "*" -} + if ($openid->mode) { + echo $openid->validate() ? 'Logged in.' : 'Failed!'; + } + ``` + +### Design for Ntpc OpenID: + +Without setting `$openid->required` values, it has default values. If full values needed, use `$openid->setRequired(1)`. For example: + +```php +$openid = new LightOpenID('my-host.example.org'); +header('Location: ' . $openid->authUrl()); ``` -### Sign-on with OpenID in just 2 steps: - - 1. Authentication with the provider: - - ```php - $openid = new LightOpenID('my-host.example.org'); - - $openid->identity = 'ID supplied by user'; - - header('Location: ' . $openid->authUrl()); - ``` - 2. Verification: - - ```php - $openid = new LightOpenID('my-host.example.org'); - - if ($openid->mode) { - echo $openid->validate() ? 'Logged in.' : 'Failed!'; - } - ``` - -### Support for AX and SREG extensions: - - To use the AX and SREG extensions, specify `$openid->required` and/or `$openid->optional` - before calling `$openid->authUrl()`. These are arrays, with values being AX schema paths - (the 'path' part of the URL). For example: - - ```php - $openid->required = array('namePerson/friendly', 'contact/email'); - $openid->optional = array('namePerson/first'); - ``` - - Note that if the server supports only SREG or OpenID 1.1, these are automaticaly mapped - to SREG names. To get the values use: - - ```php - $openid->getAttributes(); - ``` - - For more information see [USAGE.md](http://github.com/iignatov/LightOpenID/blob/master/USAGE.md). +```php +$openid = new LightOpenID('my-host.example.org'); +$openid->setRequired(1); +header('Location: ' . $openid->authUrl()); +``` +After verify correct. To get the values use: -## Requirements +```php +$openid->getNtpcData(); +``` -This library requires PHP >= 5.1.2 with cURL or HTTP/HTTPS stream wrappers enabled. +## Requirements +This library requires PHP >= 5.6 with cURL or HTTP/HTTPS stream wrappers enabled. ## Features -* Easy to use - you can code a functional client in less than ten lines of code. -* Uses cURL if avaiable, PHP-streams otherwise. -* Supports both OpenID 1.1 and 2.0. -* Supports Yadis discovery. -* Supports only stateless/dumb protocol. -* Works with PHP >= 5. -* Generates no errors with `error_reporting(E_ALL | E_STRICT)`. - +- Supports Ntpc OpenID +- Works with PHP >= 5.6 ## Links -* [JavaScript OpenID Selector](http://code.google.com/p/openid-selector/) - +- [JavaScript OpenID Selector](http://code.google.com/p/openid-selector/) - simple user interface that can be used with LightOpenID. -* [HybridAuth](http://hybridauth.sourceforge.net/) - +- [HybridAuth](http://hybridauth.sourceforge.net/) - easy to install and use social sign on PHP library, which uses LightOpenID. -* [OpenID Dev Specifications](http://openid.net/developers/specs/) - +- [OpenID Dev Specifications](http://openid.net/developers/specs/) - documentation for the OpenID extensions and related topics. - ## License [LightOpenID](http://github.com/iignatov/LightOpenID) From 3afae7c28d2341007194e71e20a43d57b21bd492 Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 15:17:32 +0800 Subject: [PATCH 06/10] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=89=B5?= =?UTF-8?q?=E5=BB=BA=E7=89=A9=E4=BB=B6=E6=99=82=20LightOpenID=20=3D>=20Ntp?= =?UTF-8?q?cOpenID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0caec7f..e5f8fc8 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Lightweight PHP5 library for easy OpenID authentication. 1. Authentication with the provider: ```php - $openid = new LightOpenID('my-host.example.org'); + $openid = new NtpcOpenID('my-host.example.org'); header('Location: ' . $openid->authUrl()); ``` @@ -44,7 +44,7 @@ Lightweight PHP5 library for easy OpenID authentication. 2. Verification: ```php - $openid = new LightOpenID('my-host.example.org'); + $openid = new NtpcOpenID('my-host.example.org'); if ($openid->mode) { echo $openid->validate() ? 'Logged in.' : 'Failed!'; @@ -56,12 +56,12 @@ Lightweight PHP5 library for easy OpenID authentication. Without setting `$openid->required` values, it has default values. If full values needed, use `$openid->setRequired(1)`. For example: ```php -$openid = new LightOpenID('my-host.example.org'); +$openid = new NtpcOpenID('my-host.example.org'); header('Location: ' . $openid->authUrl()); ``` ```php -$openid = new LightOpenID('my-host.example.org'); +$openid = new NtpcOpenID('my-host.example.org'); $openid->setRequired(1); header('Location: ' . $openid->authUrl()); ``` From 957e1dec8519602998572973e717a329838855ca Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 15:20:45 +0800 Subject: [PATCH 07/10] change README.md --- README.md | 134 ++++++++++++++++++++++++------------------------------ 1 file changed, 60 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 3dc0a81..83aa3af 100644 --- a/README.md +++ b/README.md @@ -1,110 +1,96 @@ > **NOTICE** -> I am no longer able to support or maintain this project - if you would like to take over the project, please drop me a line. +> This project is forked from github.com/iignatov/LightOpenID. Extending for Ntpc OpenID service and add a litte auto settings. It must run with openid.php together. + +# NtpcOpenID + +NtpcOpenID library for easy Ntpc OpenID Authentication and Auhtorization. + +- `Version....:` [**0.1**] +- `Source code:` [Official GitHub Repo :octocat:][5] +- `Author.....:` [Tiebob] # LightOpenID Lightweight PHP5 library for easy OpenID authentication. -* `Version....:` [**1.3.1** :arrow_double_down:][1] - ( *see [the change log][2] for details* ) -* `Released on:` March 04, 2016 -* `Source code:` [Official GitHub Repo :octocat:][3] -* `Homepage...:` http://code.google.com/p/lightopenid/ -* `Author.....:` [Mewp][4] +- `Version....:` [**1.3.1** :arrow_double_down:][1] + ( _see [the change log][2] for details_ ) +- `Released on:` March 04, 2016 +- `Source code:` [Official GitHub Repo :octocat:][3] +- `Homepage...:` http://code.google.com/p/lightopenid/ +- `Author.....:` [Mewp][4] [1]: https://github.com/iignatov/LightOpenID/archive/master.zip [2]: https://github.com/iignatov/LightOpenID/blob/master/CHANGELOG.md [3]: https://github.com/Mewp/lightopenid [4]: https://github.com/Mewp - +[5]: https://github.com/Tiebob/LightOpenID/archive/master.zip ## Quick start -### Add to composer.json +### Download openid.php and NtpcOpenID.php from github repo above. + +### Sign-on with OpenID in just 2 steps: + +1. Authentication with the provider: + + ```php + $openid = new NtpcOpenID('my-host.example.org'); + $openid->identity = "https://openid.ntpc.edu.tw/"; + header('Location: ' . $openid->authUrl()); + ``` + +2. Verification: + + ```php + $openid = new NtpcOpenID('my-host.example.org'); -```javascript -"repositories": [ - { - "type": "vcs", - "url": "https://github.com/iignatov/LightOpenID" - } -], + if ($openid->mode) { + echo $openid->validate() ? 'Logged in.' : 'Failed!'; + } + ``` -"require": { - "php": ">=5.4.0", - "iignatov/lightopenid": "*" -} +### Design for Ntpc OpenID: + +Without setting `$openid->required` values, it has default values. If full values needed, use `$openid->setRequired(1)`. For example: + +```php +$openid = new NtpcOpenID('my-host.example.org'); +$openid->identity = "https://openid.ntpc.edu.tw/"; +header('Location: ' . $openid->authUrl()); ``` -### Sign-on with OpenID in just 2 steps: - - 1. Authentication with the provider: - - ```php - $openid = new LightOpenID('my-host.example.org'); - - $openid->identity = 'ID supplied by user'; - - header('Location: ' . $openid->authUrl()); - ``` - 2. Verification: - - ```php - $openid = new LightOpenID('my-host.example.org'); - - if ($openid->mode) { - echo $openid->validate() ? 'Logged in.' : 'Failed!'; - } - ``` - -### Support for AX and SREG extensions: - - To use the AX and SREG extensions, specify `$openid->required` and/or `$openid->optional` - before calling `$openid->authUrl()`. These are arrays, with values being AX schema paths - (the 'path' part of the URL). For example: - - ```php - $openid->required = array('namePerson/friendly', 'contact/email'); - $openid->optional = array('namePerson/first'); - ``` - - Note that if the server supports only SREG or OpenID 1.1, these are automaticaly mapped - to SREG names. To get the values use: - - ```php - $openid->getAttributes(); - ``` - - For more information see [USAGE.md](http://github.com/iignatov/LightOpenID/blob/master/USAGE.md). +```php +$openid = new NtpcOpenID('my-host.example.org'); +$openid->setRequired(1); +header('Location: ' . $openid->authUrl()); +``` +After verify correct. To get the values use: -## Requirements +```php +$openid->getNtpcData(); +``` -This library requires PHP >= 5.1.2 with cURL or HTTP/HTTPS stream wrappers enabled. +## Requirements +This library requires PHP >= 5.6 with cURL or HTTP/HTTPS stream wrappers enabled. ## Features -* Easy to use - you can code a functional client in less than ten lines of code. -* Uses cURL if avaiable, PHP-streams otherwise. -* Supports both OpenID 1.1 and 2.0. -* Supports Yadis discovery. -* Supports only stateless/dumb protocol. -* Works with PHP >= 5. -* Generates no errors with `error_reporting(E_ALL | E_STRICT)`. - +- Supports Ntpc OpenID +- Works with PHP >= 5.6 ## Links -* [JavaScript OpenID Selector](http://code.google.com/p/openid-selector/) - +- [JavaScript OpenID Selector](http://code.google.com/p/openid-selector/) - simple user interface that can be used with LightOpenID. -* [HybridAuth](http://hybridauth.sourceforge.net/) - +- [HybridAuth](http://hybridauth.sourceforge.net/) - easy to install and use social sign on PHP library, which uses LightOpenID. -* [OpenID Dev Specifications](http://openid.net/developers/specs/) - +- [OpenID Dev Specifications](http://openid.net/developers/specs/) - documentation for the OpenID extensions and related topics. - ## License [LightOpenID](http://github.com/iignatov/LightOpenID) From 5a1080c288b80c1a1f8032da0993119ce8d4d498 Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 15:41:23 +0800 Subject: [PATCH 08/10] add: example-ntpc.php --- examples/example-ntpc.php | 85 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 examples/example-ntpc.php diff --git a/examples/example-ntpc.php b/examples/example-ntpc.php new file mode 100644 index 0000000..e2e81bb --- /dev/null +++ b/examples/example-ntpc.php @@ -0,0 +1,85 @@ +mode) { + $openid->identity = "https://openid.ntpc.edu.tw/"; + header('Location: ' . $openid->authUrl()); + } + } catch (ErrorException $e) { + echo $e->getMessage(); + } +?> + + + + + + + + + + mode && $openid->validate()) { ?> + getNtpcData(); ?> +

+ 登出 +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
欄位內容
帳號 + +
+
公務信箱
單位簡稱
年級
班級
座號
+ +
+

+

+ +

+ +
+ +
+ + + + \ No newline at end of file From cac8029d04ad8d003b51eda59c04f570ece8d0b9 Mon Sep 17 00:00:00 2001 From: Tiebob Date: Tue, 28 Jul 2020 16:00:57 +0800 Subject: [PATCH 09/10] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83aa3af..7ad0199 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ > **NOTICE** -> This project is forked from github.com/iignatov/LightOpenID. Extending for Ntpc OpenID service and add a litte auto settings. It must run with openid.php together. +> This project is forked from github.com/iignatov/LightOpenID. Extending for Ntpc OpenID service and add some settings. It must run with openid.php together. # NtpcOpenID From 2e84011b10c0f2ac81a0b4e64afffcafccd036e7 Mon Sep 17 00:00:00 2001 From: Tiebob Date: Thu, 6 Aug 2020 11:55:43 +0800 Subject: [PATCH 10/10] update README --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7ad0199..6adaeca 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,6 @@ > This project is forked from github.com/iignatov/LightOpenID. Extending for Ntpc OpenID service and add some settings. It must run with openid.php together. -# NtpcOpenID - -NtpcOpenID library for easy Ntpc OpenID Authentication and Auhtorization. - -- `Version....:` [**0.1**] -- `Source code:` [Official GitHub Repo :octocat:][5] -- `Author.....:` [Tiebob] - # LightOpenID Lightweight PHP5 library for easy OpenID authentication. @@ -21,11 +13,21 @@ Lightweight PHP5 library for easy OpenID authentication. - `Homepage...:` http://code.google.com/p/lightopenid/ - `Author.....:` [Mewp][4] +# NtpcOpenID + +NtpcOpenID library for easy Ntpc OpenID Authentication and Auhtorization. + +- `Version....:` [**1.3.2**][5] +- `Source code:` [Official GitHub Repo :octocat:][6] +- `Author.....:` [Tiebob][7] + [1]: https://github.com/iignatov/LightOpenID/archive/master.zip [2]: https://github.com/iignatov/LightOpenID/blob/master/CHANGELOG.md [3]: https://github.com/Mewp/lightopenid [4]: https://github.com/Mewp [5]: https://github.com/Tiebob/LightOpenID/archive/master.zip +[6]: https://github.com/Tiebob/LightOpenID +[7]: https://github.com/Tiebob ## Quick start