diff options
author | dakkar <dakkar@thenautilus.net> | 2014-12-30 11:57:48 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2014-12-30 11:57:48 +0000 |
commit | 3294492369e6801b79eaf4ac36310ab6dde9a654 (patch) | |
tree | 83aff05ed940c9e6ac9720dd43bbca8f45d1d363 /lib | |
parent | whitespace fixes (diff) | |
download | net-hawk-3294492369e6801b79eaf4ac36310ab6dde9a654.tar.gz net-hawk-3294492369e6801b79eaf4ac36310ab6dde9a654.tar.bz2 net-hawk-3294492369e6801b79eaf4ac36310ab6dde9a654.zip |
start of uri tests
the implementation is a stub!
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Net/Hawk/Client.pm | 10 | ||||
-rw-r--r-- | lib/Net/Hawk/Server.pm | 18 | ||||
-rw-r--r-- | lib/Net/Hawk/Uri.pm | 7 |
3 files changed, 35 insertions, 0 deletions
diff --git a/lib/Net/Hawk/Client.pm b/lib/Net/Hawk/Client.pm index 5f649c4..fd28532 100644 --- a/lib/Net/Hawk/Client.pm +++ b/lib/Net/Hawk/Client.pm @@ -145,4 +145,14 @@ package Net::Hawk::Client { return $calculated_hash eq $attributes<hash>; }; + our proto getBewit(*@,*%) {*}; + multi getBewit(Str:D $uri!,*%nam) { + return getBewit(URI.new($uri),|%nam); + }; + multi getBewit( + URI:D $uri!, + :%credentials!, + Int:D :$ttl_sec!, + Str :$ext, + ) { return "$ext" }; } diff --git a/lib/Net/Hawk/Server.pm b/lib/Net/Hawk/Server.pm new file mode 100644 index 0000000..1b39352 --- /dev/null +++ b/lib/Net/Hawk/Server.pm @@ -0,0 +1,18 @@ +package Net::Hawk::Server { + use v6; + + our sub authenticate( + %request!, + &credentialsFunc:($,&)!, + %whatever!, + &callback:($,%,%)!, + ) { + my %creds; + &credentialsFunc.('some id', sub ($err,%credentials) { %creds = %credentials }); + %request<url> ~~ m{'bewit=' $<ext>=(.*?) ['&'|$]}; + my %attributes = ( + ext => $/<ext>; + ); + &callback.(Nil,%creds,%attributes); + }; +}; diff --git a/lib/Net/Hawk/Uri.pm b/lib/Net/Hawk/Uri.pm new file mode 100644 index 0000000..544afd9 --- /dev/null +++ b/lib/Net/Hawk/Uri.pm @@ -0,0 +1,7 @@ +package Net::Hawk::Uri { + use v6; + use Net::Hawk::Client; + use Net::Hawk::Server; + our constant &getBewit := &Net::Hawk::Client::getBewit; + our constant &authenticate := &Net::Hawk::Server::authenticate; +} |