Class ::xo::oauth::Signature (public)
::xotcl::Class ::xo::oauth::Signature
Defined in
- Testcases:
-
No testcase defined.
Source code:
namespace eval ::xo::oauth {}
::nsf::object::alloc ::xotcl::Class ::xo::oauth::Signature {set :__default_metaclass ::xotcl::Class
set :__default_superclass ::xotcl::Object}
::xo::oauth::Signature proc base_string_from_url uri {
set info [uri::split $uri]
set base_string_uri [uri::join scheme [dict get $info scheme] host [dict get $info host] port [dict get $info port] path [dict get $info path]]
return $base_string_uri
}
::xo::oauth::Signature instproc normalize_parameters {} {
set parameter_pair_list [:signature_parameters]
set encoded_parameter_pair_list {}
foreach pair $parameter_pair_list {
lassign $pair key value
if {[string match "*secret" $key]} continue
lappend encoded_parameter_pair_list [list [:encode $key] [:encode $value]]
}
foreach pair $encoded_parameter_pair_list {
lassign $pair key value
lappend concatenated_parameter_list [list ${key}=${value}]
}
set sorted_concatenated_parameter_list [lsort $concatenated_parameter_list]
set normalized_parameters [join $sorted_concatenated_parameter_list &]
set encoded_normalized_parameters [:encode $normalized_parameters]
return $encoded_normalized_parameters
}
::xo::oauth::Signature instproc construct_base_string {} {
append sbs [:encode [string toupper [:request_method]]]
append sbs "&"
append sbs [:encode [:base_string_uri]]
append sbs "&"
append sbs [:normalize_parameters]
return $sbs
}
::xo::oauth::Signature instproc encode s {
return [::xo::oauth::utility urlencode $s]
}
::xo::oauth::Signature instproc generate {} {
set signature [ns_crypto::hmac string -binary -digest sha1 -encoding base64 [:encode ${:client_secret}]&[:encode ${:token_secret}] [:construct_base_string] ]
return $signature
}
::xo::oauth::Signature instparametercmd base_string_uri
::xo::oauth::Signature instparametercmd client_secret
::xo::oauth::Signature instparametercmd signature_parameters
::xo::oauth::Signature instparametercmd request_method
::xo::oauth::Signature instparametercmd token_secret
::nx::slotObj -container slot ::xo::oauth::Signature
::xo::oauth::Signature::slot eval {set :__parameter {
{request_method "POST"}
base_string_uri
signature_parameters
client_secret
{token_secret ""}
}}
::nsf::object::alloc ::xotcl::Attribute ::xo::oauth::Signature::slot::client_secret {set :accessor public
set :configurable true
set :convert false
set :defaultmethods {}
set :disposition alias
set :domain ::xo::oauth::Signature
set :incremental 0
set :manager ::xo::oauth::Signature::slot::client_secret
set :methodname client_secret
set :multiplicity 1..1
set :name client_secret
set :per-object false
set :position 0
set :required false
set :trace none
: init}
::nsf::object::alloc ::xotcl::Attribute ::xo::oauth::Signature::slot::base_string_uri {set :accessor public
set :configurable true
set :convert false
set :defaultmethods {}
set :disposition alias
set :domain ::xo::oauth::Signature
set :incremental 0
set :manager ::xo::oauth::Signature::slot::base_string_uri
set :methodname base_string_uri
set :multiplicity 1..1
set :name base_string_uri
set :per-object false
set :position 0
set :required false
set :trace none
: init}
::nsf::object::alloc ::xotcl::Attribute ::xo::oauth::Signature::slot::request_method {set :accessor public
set :configurable true
set :convert false
set :default POST
set :defaultmethods {}
set :disposition alias
set :domain ::xo::oauth::Signature
set :incremental 0
set :manager ::xo::oauth::Signature::slot::request_method
set :methodname request_method
set :multiplicity 1..1
set :name request_method
set :per-object false
set :position 0
set :required false
set :substdefault 0b111
set :trace none
: init}
::nsf::object::alloc ::xotcl::Attribute ::xo::oauth::Signature::slot::signature_parameters {set :accessor public
set :configurable true
set :convert false
set :defaultmethods {}
set :disposition alias
set :domain ::xo::oauth::Signature
set :incremental 0
set :manager ::xo::oauth::Signature::slot::signature_parameters
set :methodname signature_parameters
set :multiplicity 1..1
set :name signature_parameters
set :per-object false
set :position 0
set :required false
set :trace none
: init}
::nsf::object::alloc ::xotcl::Attribute ::xo::oauth::Signature::slot::token_secret {set :accessor public
set :configurable true
set :convert false
set :default {}
set :defaultmethods {}
set :disposition alias
set :domain ::xo::oauth::Signature
set :incremental 0
set :manager ::xo::oauth::Signature::slot::token_secret
set :methodname token_secret
set :multiplicity 1..1
set :name token_secret
set :per-object false
set :position 0
set :required false
set :substdefault 0b111
set :trace none
: init}
XQL Not present:Generic, PostgreSQL, Oracle
[
hide source ]
| [
make this the default ]