design.txt 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Interfaces:
  2. # OAuthConsumer is a data type that represents the identity of the Consumer
  3. # via its shared secret with the Service Provider.
  4. OAuthConsumer
  5. - key : str
  6. - secret : str
  7. # OAuthToken is a data type that represents an End User via either an access
  8. # or request token
  9. OAuthToken
  10. - token : str
  11. - secret : str
  12. - to_string() -> str
  13. - (static) from_string() -> OAuthToken
  14. # OAuthSignatureMethod is a strategy class that implements a signature method
  15. OAuthSignatureMethod
  16. - get_name() -> str
  17. - build_signature (OAuthRequest, OAuthConsumer, OAuthToken) -> str
  18. # OAuthRequest represents the request and can be seriali
  19. OAuthRequest:
  20. - OAuthRequest(str http_method, str http_url, [dict parameters]) -> constructor
  21. - set_parameter(str parameter, str value) -> void
  22. - example parameters: oauth_consumer_key, foo
  23. - get_parameter(str parameter) -> str
  24. - get_parameters() -> dict
  25. - get_normalized_http_method() -> str
  26. - get_normalized_http_url() -> str
  27. - get_signable_params() -> dict
  28. - to_header () -> str # serialize as a header for an HTTPAuth request
  29. - to_postdata () -> str # serialize as post data for a POST request
  30. - to_url () -> str # serialize as a url for a GET request
  31. - sign_request(OAuthSignatureMethod, OAuthConsumer, OAuthToken) -> void
  32. - build_signature(OAuthSignatureMethod, OAuthConsumer, OAuthToken) -> str
  33. - (static) from_request([str http_method, str http_url, dict parameters])
  34. - (static) from_consumer_and_token(OAuthConsumer, OAuthToken, str http_method, str http_url, [dict parameters]) -> OAuthRequest
  35. # OAuthServer is a worker to check a requests validity against a data store
  36. OAuthServer:
  37. - OAuthServer(OAuthDataStore) -> constructor
  38. - set_data_store(OAuthDataStore) -> void
  39. - get_data_store() -> OAuthDataStore
  40. - fetch_request_token (OAuthRequest) -> OAuthToken
  41. - fetch_access_token (OAuthRequest) -> OAuthToken
  42. - verify_request (OAuthRequest) -> OAuthToken
  43. # OAuthClient is a worker to attempt to execute a request
  44. OAuthClient:
  45. - OAuthClient(OAuthConsumer, OAuthToken) -> constructor
  46. - get_consumer() -> OAuthConsumer
  47. - get_token() -> OAuthToken
  48. - fetch_request_token (OAuthRequest) -> OAuthToken
  49. - fetch_access_token (OAuthRequest) -> OAuthToken
  50. # OAuthDataStore is a database abstraction used to lookup consumers and tokens
  51. OAuthDataStore:
  52. - lookup_consumer(str key) -> OAuthConsumer
  53. - lookup_token(OAuthConsumer, str token_type, str token_token) -> OAuthToken
  54. - lookup_nonce(OAuthConsumer, OAuthToken, str nonce, int timestamp) -> OAuthToken
  55. - fetch_request_token(OAuthConsumer) -> OAuthToken
  56. - fetch_access_token(OAuthConsumer, OAuthToken) -> OAuthToken