学生かどうかの情報を含む属性情報を安全に流通させるしくみ
簡単に動くやつつくってみた。予定はないけどデモとかに使えるようにするのが今回の目的。
| <?php | |
| // Request Token Endpoint | |
| $req_url = 'https://auth.login.yahoo.co.jp/oauth/v2/get_request_token'; | |
| // AuthZ Endpoint | |
| $authurl = 'https://auth.login.yahoo.co.jp/oauth/v2/request_auth'; | |
| // Access Token Endpoint | |
| $acc_url = 'https://auth.login.yahoo.co.jp/oauth/v2/get_token'; | |
| // callback_url | |
| $cbc_url = '(戻り先URL)'; |
| # RSA PubKey Generate??? | |
| $ openssl genrsa -out private.key | |
| Generating RSA private key, 512 bit long modulus | |
| ......++++++++++++ | |
| ...++++++++++++ | |
| unable to write 'random state' | |
| e is 65537 (0x10001) | |
| $ openssl rsa -in private.key -out public.key -pubout |
| $ cat test.php | |
| <?php | |
| function base64_urlencode($str){ | |
| $enc = base64_encode($str); | |
| $enc = rtrim($enc,"="); | |
| $enc = strtr($enc,"+/","-_"); | |
| return $enc; | |
| } |
| $ cat Authen_OATH_sample.pl | |
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use Authen::OATH; | |
| use MIME::Base32 qw( RFC ); | |
| my $oath = Authen::OATH->new(); |
| OP : Registration | |
| === | |
| <intent | |
| action="http://webintents.org/openid" | |
| type="application/JSON" | |
| href="/.well-known/openid-configuration" | |
| /> | |
| === | |
| RP : |
| Memo : JR System UserInfo & Resource | |
| メモメモ | |
| === | |
| やること | |
| UserInfo |
| Test Tool : http://www.kodtest.se/oictest/ | |
| Env : VM Player, CentOS 6(64bit) | |
| # setup | |
| $ cd oictest/test/oic | |
| $ cat ryo.py | |
| #!/usr/bin/env python | |
| import json |
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use Acme::JWT; | |
| use JSON::XS; | |
| use Data::Dumper; | |
| use Crypt::OpenSSL::RSA; | |
| use Convert::PEM; |
| <?php | |
| // Request Token Endpoint | |
| $req_url = 'https://auth.login.yahoo.co.jp/oauth/v2/get_request_token'; | |
| // AuthZ Endpoint | |
| $authurl = 'https://auth.login.yahoo.co.jp/oauth/v2/request_auth'; | |
| // Access Token Endpoint | |
| $acc_url = 'https://auth.login.yahoo.co.jp/oauth/v2/get_token'; | |
| // callback_url | |
| $cbc_url = '(戻り先)'; |