Make invalid token request.

At least it compiles now...

Signed-off-by: Luca Fulchir <luca@fulchir.it>
parent 392bf4cb
*~
.class
.jar
diagram.png

90.9 KB

......@@ -12,5 +12,5 @@ clean:
- rm -rf ${BUILDDIR}
demo1:
jolie jolie/net/OAuth1/demo.ol
jolie jolie/net/OAuth/demo.ol
include "OAuth1Data.iol"
interface OAuth1Interface {
RequestResponse:
RequestToken (OAuth1Locations) (string)
}
outputPort OAuth1 {
Interfaces: OAuth1Interface
}
embedded {
Jolie:
"OAuth1.ol" in OAuth1
}
include "OAuth1.iol"
include "console.iol"
interface OAuth1Interface_http {
RequestResponse:
RequestToken_http (OAuth1TokenReq) (string)
}
outputPort OAuth1_http {
Interfaces: OAuth1Interface_http
}
inputPort OAuth1 {
Location: "local"
Interfaces: OAuth1Interface
}
main {
RequestToken (where) (answer) {
OAuth1_http.location = where.location;
proto = "http";
proto.method = where.method;
OAuth1_http.protocol = proto;
DataRequestToken@OAuth1Data (where) (post_data);
RequestToken_http@OAuth1_http(post_data) (answer)
}
}
include "console.iol"
include "OAuth1.iol"
include "security_utils.iol"
main
{
// data needed for the connection: where to connect, how and who we are
data.location = "socket://api.dropbox.com:80/1/oauth/request_token";
data.method = "post";
data.callback = "";
createSecureToken@SecurityUtils(void)(data.consumer_key);
// send the message
RequestToken@OAuth1 (data) (answer);
println@Console (answer)()
}
type OAuth1Locations:void {
.location :string
.method :string
.callback :string
.consumer_key :string
}
type OAuth1TokenReq:void {
.oauth_callback :string
.oauth_version :string
.oauth_signature_method :string
.oauth_consumer_key :string
.oauth_timestamp :string
.oauth_nonce :string
.oauth_signature :string
}
interface OAuth1DataInterface {
RequestResponse:
DataRequestToken (OAuth1Locations) (OAuth1TokenReq)
}
outputPort OAuth1Data {
Interfaces: OAuth1DataInterface
}
embedded {
Jolie:
"OAuth1Data.ol" in OAuth1Data
}
include "security_utils.iol"
include "time.iol"
include "OAuth1Data.iol"
include "string_utils.iol"
inputPort OAuth1Data{
Location: "local"
Interfaces: OAuth1DataInterface
}
main {
DataRequestToken (where) (answ) {
// optional. we would need a web server.
answ.oauth_callback = where.callback;
answ.oauth_version = "1.0";
answ.oauth_consumer_key = where.consumer_key;
answ.oauth_signature_method="HMAC-SHA1";
// getCurrentTimeMillis is a temporary interface, but there's
// nothing better :(
getCurrentTimeMillis@Time(void)(tmp_timestamp);
valueToPrettyString@StringUtils(tmp_timestamp / 1000) (answ.oauth_timestamp);
// a little too much as a nonce, but it's easier this way :p
createSecureToken@SecurityUtils(void)(answ.oauth_nonce);
// we are requesting a token, there is no secret, the signature
// has no meaning here.
answ.oauth_signature=""
}
}
......@@ -24,11 +24,8 @@ include "jolie/net/utils/URLEncoder.iol"
main
{
rnd = SecureRandomRequest;
rnd.size = 5;
secureRandom@SecurityUtils(rnd)(answer);
println@Console( "Answer is " + answer )();
createSecureToken@SecurityUtils(void)(uff);
println@Console( "uuid: " + uff )();
input = URLEncoderRequest;
input.input = "http://printer.example.com/ready";
......@@ -37,5 +34,6 @@ main
encode@URLEncoder(input)(output);
println@Console( "Answer is " + output )()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment