Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
979c6579ab | ||
|
|
97fa26fce7 | ||
|
|
2f55386995 | ||
|
|
23fa5946a9 | ||
|
|
cf9c4be00c | ||
|
|
b35ea8d8ed | ||
|
|
5ad8059b08 | ||
|
|
294c3115d5 | ||
|
|
d721204939 | ||
|
|
965a1ecd3f | ||
|
|
ebe4b0e7db | ||
|
|
8c8bcfcafd | ||
|
|
8ceebf2ded | ||
|
|
0a45342004 | ||
|
|
3f4189607c | ||
|
|
5c030ca360 | ||
|
|
d39f7ab3fc | ||
|
|
89ddd131e4 | ||
|
|
13d1eaea0a | ||
|
|
488fc1451a | ||
|
|
1208fd815a | ||
|
|
ed65d25697 | ||
|
|
d35ef44b02 | ||
|
|
129337d4d4 | ||
|
|
90081a572c | ||
|
|
2538b96545 | ||
|
|
6ae769e35e | ||
|
|
b50aeba5cb | ||
|
|
3132a9dfe7 | ||
|
|
f9af115645 | ||
|
|
6752167925 | ||
|
|
b83113a025 | ||
|
|
9fbc9b2d72 | ||
|
|
4bb6e49b61 | ||
|
|
98801d7b86 | ||
|
|
dbc1bd9c85 | ||
|
|
92ffe2cc03 | ||
|
|
4aa6256487 | ||
|
|
9c631674d2 | ||
|
|
f4c36ab27a | ||
|
|
60872fe55f | ||
|
|
84dd4660e2 | ||
|
|
d746a013ea | ||
|
|
7b45840df3 | ||
|
|
0967770d43 | ||
|
|
69fff5b2c4 | ||
|
|
ceae6f85cc | ||
|
|
d1df7a7fb0 | ||
|
|
b702f097a2 | ||
|
|
4536f71188 | ||
|
|
42ef871a61 | ||
|
|
74f53a4d07 | ||
|
|
b8378a35f2 | ||
|
|
9e848993f6 | ||
|
|
1e05fc0828 | ||
|
|
4dd7aa0bc2 | ||
|
|
79d26389e7 | ||
|
|
bef18c570e | ||
|
|
56235d9b15 | ||
|
|
0254d551d6 | ||
|
|
b13181af35 | ||
|
|
e000757d24 | ||
|
|
41777bc0d0 | ||
|
|
bfbba77e4c | ||
|
|
762e1004f8 | ||
|
|
f77391eca4 | ||
|
|
6cfdf973f8 | ||
|
|
aa5e27b263 | ||
|
|
b5f75628bb |
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
# kickstart travis.
|
||||||
|
language: java
|
||||||
|
|
||||||
|
# need to override travis 'install' since it will try gpg sign and fail.
|
||||||
|
install: mvn clean package -DskipTests=true
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
The MIT License
|
The MIT License
|
||||||
|
|
||||||
Copyright (c) 2010 Pablo Fenandez
|
Copyright (c) 2010 Pablo Fernandez
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+10
-2
@@ -1,5 +1,7 @@
|
|||||||
h2. Welcome to the home of Scribe, the simple OAuth Java lib!
|
h2. Welcome to the home of Scribe, the simple OAuth Java lib!
|
||||||
|
|
||||||
|
!https://secure.travis-ci.org/fernandezpablo85/scribe-java.png?branch=master(travis-ci-status)!
|
||||||
|
|
||||||
h1. Why use Scribe?
|
h1. Why use Scribe?
|
||||||
|
|
||||||
h3. Dead Simple
|
h3. Dead Simple
|
||||||
@@ -74,9 +76,15 @@ h1. Please Read the "FAQ":http://wiki.github.com/fernandezpablo85/scribe-java/fa
|
|||||||
|
|
||||||
h1. Questions?
|
h1. Questions?
|
||||||
|
|
||||||
Feel free to drop me an email, but there's already a "StackOvferflow":http://stackoverflow.com tag for "scribe":http://stackoverflow.com/questions/tagged/scribe you should use. I'm subscribed to it so I'll pick the question immediately.
|
Feel free to drop me an email, but there's already a "StackOverflow":http://stackoverflow.com tag for "scribe":http://stackoverflow.com/questions/tagged/scribe you should use. I'm subscribed to it so I'll pick the question immediately.
|
||||||
|
|
||||||
Note that it really helps to run scribe on **debug** mode (since 1.3.0), to get additional info. To do this simply call the @.debug()@ method on the @ServiceBuilder@.
|
Note that it really helps to run scribe on "debug mode":https://github.com/fernandezpablo85/scribe-java/wiki/debug-mode (since 1.3.0), to get additional info. To do this simply call the @.debug()@ method on the @ServiceBuilder@.
|
||||||
|
|
||||||
|
h1. Forks
|
||||||
|
|
||||||
|
Looking for a scribe variation? check the "Fork List":https://github.com/fernandezpablo85/scribe-java/wiki/Forks
|
||||||
|
|
||||||
|
If you have a useful fork that should be listed there please contact me (see About me).
|
||||||
|
|
||||||
h1. About me
|
h1. About me
|
||||||
|
|
||||||
|
|||||||
@@ -71,3 +71,18 @@
|
|||||||
* FEATURE: Plurk Mobile Api
|
* FEATURE: Plurk Mobile Api
|
||||||
* FEATURE: Kaixin and QWeibo Apis
|
* FEATURE: Kaixin and QWeibo Apis
|
||||||
* FEATURE: SimpleGeo Api
|
* FEATURE: SimpleGeo Api
|
||||||
|
|
||||||
|
[1.3.0]
|
||||||
|
* FEATURE: Multiple parameters with the same name supported.
|
||||||
|
* FEAUTRE: 'debug' mode that logs useful information about the signature making
|
||||||
|
|
||||||
|
[1.3.1]
|
||||||
|
* FEATURE: Meetup.com Api
|
||||||
|
* FEATURE: NetProspex Api
|
||||||
|
* FEATURE: Kaixin2, SinaWeibo2 and Renren Apis
|
||||||
|
* FEATURE: ImgUr Api
|
||||||
|
* FEATURE: Freelancer Api (thanks Juan Palacios!)
|
||||||
|
* FIX: Allow digits in url schemes
|
||||||
|
* FEATURE: Specific exception for connection problems (OAuthConnectionException)
|
||||||
|
* FIX: Dropbox Api and Evernote Api updated to their latests versions
|
||||||
|
* FIX: Digg and Skyrock Apis
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.scribe</groupId>
|
<groupId>org.scribe</groupId>
|
||||||
<artifactId>scribe</artifactId>
|
<artifactId>scribe</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.3.0</version>
|
<version>1.3.1</version>
|
||||||
<name>Scribe OAuth Library</name>
|
<name>Scribe OAuth Library</name>
|
||||||
<description>The best OAuth library out there</description>
|
<description>The best OAuth library out there</description>
|
||||||
<url>http://github.com/fernandezpablo85/scribe-java</url>
|
<url>http://github.com/fernandezpablo85/scribe-java</url>
|
||||||
|
|||||||
@@ -0,0 +1,290 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><profiles version="12">
|
||||||
|
<profile kind="CodeFormatterProfile" name="scribe" version="12">
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="9999"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="32"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="9999"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="48"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#Organize Import Order
|
||||||
|
#Tue Feb 21 20:29:55 GMT 2012
|
||||||
|
4=java
|
||||||
|
3=javax
|
||||||
|
2=org
|
||||||
|
1=org.boncey
|
||||||
|
0=com
|
||||||
@@ -84,7 +84,7 @@ public class ServiceBuilder
|
|||||||
*/
|
*/
|
||||||
public ServiceBuilder callback(String callback)
|
public ServiceBuilder callback(String callback)
|
||||||
{
|
{
|
||||||
Preconditions.checkValidOAuthCallback(callback, "Callback must be a valid URL or 'oob'");
|
Preconditions.checkNotNull(callback, "Callback can't be null");
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.*;
|
||||||
|
|
||||||
|
public class DiggApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final String AUTHORIZATION_URL = "http://digg.com/oauth/authorize?oauth_token=%s";
|
||||||
|
private static final String BASE_URL = "http://services.digg.com/oauth/";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return BASE_URL + "request_token";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return BASE_URL + "access_token";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZATION_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,19 +7,19 @@ public class DropBoxApi extends DefaultApi10a
|
|||||||
@Override
|
@Override
|
||||||
public String getAccessTokenEndpoint()
|
public String getAccessTokenEndpoint()
|
||||||
{
|
{
|
||||||
return "https://api.dropbox.com/0/oauth/access_token";
|
return "https://api.dropbox.com/1/oauth/access_token";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAuthorizationUrl(Token requestToken)
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
{
|
{
|
||||||
return "https://www.dropbox.com/0/oauth/authorize?oauth_token="+requestToken.getToken();
|
return "https://www.dropbox.com/1/oauth/authorize?oauth_token="+requestToken.getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRequestTokenEndpoint()
|
public String getRequestTokenEndpoint()
|
||||||
{
|
{
|
||||||
return "https://api.dropbox.com/0/oauth/request_token";
|
return "https://api.dropbox.com/1/oauth/request_token";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,17 @@
|
|||||||
package org.scribe.builder.api;
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
import org.scribe.model.Token;
|
import org.scribe.model.Token;
|
||||||
import org.scribe.model.Verb;
|
|
||||||
|
|
||||||
public class EvernoteApi extends DefaultApi10a
|
public class EvernoteApi extends DefaultApi10a
|
||||||
{
|
{
|
||||||
private static final String AUTHORIZATION_URL = "https://www.evernote.com/OAuth.action?oauth_token=%s";
|
private static final String AUTHORIZATION_URL = "https://www.evernote.com/OAuth.action?oauth_token=%s";
|
||||||
|
|
||||||
@Override
|
|
||||||
public Verb getRequestTokenVerb()
|
|
||||||
{
|
|
||||||
return Verb.GET;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRequestTokenEndpoint()
|
public String getRequestTokenEndpoint()
|
||||||
{
|
{
|
||||||
return "https://www.evernote.com/oauth";
|
return "https://www.evernote.com/oauth";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Verb getAccessTokenVerb()
|
|
||||||
{
|
|
||||||
return Verb.GET;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAccessTokenEndpoint()
|
public String getAccessTokenEndpoint()
|
||||||
{
|
{
|
||||||
@@ -39,24 +26,24 @@ public class EvernoteApi extends DefaultApi10a
|
|||||||
|
|
||||||
public static class Sandbox extends EvernoteApi
|
public static class Sandbox extends EvernoteApi
|
||||||
{
|
{
|
||||||
private static final String SANDBOX_URL = "https://sandbox.evernote.com/oauth";
|
private static final String SANDBOX_URL = "https://sandbox.evernote.com";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRequestTokenEndpoint()
|
public String getRequestTokenEndpoint()
|
||||||
{
|
{
|
||||||
return SANDBOX_URL;
|
return SANDBOX_URL + "/oauth";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAccessTokenEndpoint()
|
public String getAccessTokenEndpoint()
|
||||||
{
|
{
|
||||||
return SANDBOX_URL;
|
return SANDBOX_URL + "/oauth";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAuthorizationUrl(Token requestToken)
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
{
|
{
|
||||||
return String.format(SANDBOX_URL + "?oauth_token=%s", requestToken.getToken());
|
return String.format(SANDBOX_URL + "/OAuth.action?oauth_token=%s", requestToken.getToken());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth API for Flickr.
|
||||||
|
*
|
||||||
|
* @author Darren Greaves
|
||||||
|
* @see <a href="http://www.flickr.com/services/api/">Flickr API</a>
|
||||||
|
*/
|
||||||
|
public class FlickrApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://www.flickr.com/services/oauth/access_token";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return "http://www.flickr.com/services/oauth/authorize?oauth_token=" + requestToken.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://www.flickr.com/services/oauth/request_token";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.*;
|
||||||
|
|
||||||
|
public class FreelancerApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
private static final String AUTHORIZATION_URL = "http://www.freelancer.com/users/api-token/auth.php?oauth_token=%s";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://api.freelancer.com/RequestAccessToken/requestAccessToken.xml?";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://api.freelancer.com/RequestRequestToken/requestRequestToken.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Verb getAccessTokenVerb()
|
||||||
|
{
|
||||||
|
return Verb.GET;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Verb getRequestTokenVerb()
|
||||||
|
{
|
||||||
|
return Verb.GET;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZATION_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Sandbox extends FreelancerApi
|
||||||
|
{
|
||||||
|
private static final String SANDBOX_AUTHORIZATION_URL = "http://www.sandbox.freelancer.com/users/api-token/auth.php";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://api.sandbox.freelancer.com/RequestRequestToken/requestRequestToken.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://api.sandbox.freelancer.com/RequestAccessToken/requestAccessToken.xml?";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(SANDBOX_AUTHORIZATION_URL + "?oauth_token=%s", requestToken.getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.Token;
|
||||||
|
|
||||||
|
public class GetGlueApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
private static final String AUTHORIZE_URL = "http://getglue.com/oauth/authorize?oauth_token=%s";
|
||||||
|
private static final String REQUEST_TOKEN_RESOURCE = "https://api.getglue.com/oauth/request_token";
|
||||||
|
private static final String ACCESS_TOKEN_RESOURCE = "https://api.getglue.com/oauth/access_token";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return ACCESS_TOKEN_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return REQUEST_TOKEN_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZE_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth API for ImgUr
|
||||||
|
*
|
||||||
|
* @author David Wursteisen
|
||||||
|
* @see <a href="http://api.imgur.com/#authapi">ImgUr API</a>
|
||||||
|
*/
|
||||||
|
public class ImgUrApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "https://api.imgur.com/oauth/request_token";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "https://api.imgur.com/oauth/access_token";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format("https://api.imgur.com/oauth/authorize?oauth_token=%s", requestToken.getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.extractors.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.utils.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kaixin(http://www.kaixin001.com/) open platform api based on OAuth 2.0.
|
||||||
|
*/
|
||||||
|
public class KaixinApi20 extends DefaultApi20
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final String AUTHORIZE_URL = "http://api.kaixin001.com/oauth2/authorize?client_id=%s&redirect_uri=%s&response_type=code";
|
||||||
|
private static final String SCOPED_AUTHORIZE_URL = AUTHORIZE_URL + "&scope=%s";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessTokenExtractor getAccessTokenExtractor()
|
||||||
|
{
|
||||||
|
return new JsonTokenExtractor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "https://api.kaixin001.com/oauth2/access_token?grant_type=authorization_code";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(OAuthConfig config)
|
||||||
|
{
|
||||||
|
// Append scope if present
|
||||||
|
if (config.hasScope())
|
||||||
|
{
|
||||||
|
return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.Token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth access to the Meetup.com API.
|
||||||
|
* For more information visit http://www.meetup.com/api
|
||||||
|
*/
|
||||||
|
public class MeetupApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
private static final String AUTHORIZE_URL = "http://www.meetup.com/authenticate?oauth_token=%s";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://api.meetup.com/oauth/request/";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "http://api.meetup.com/oauth/access/";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZE_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.Token;
|
||||||
|
|
||||||
|
public class MisoApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
private static final String AUTHORIZE_URL = "http://gomiso.com/oauth/authorize?oauth_token=%s";
|
||||||
|
private static final String REQUEST_TOKEN_RESOURCE = "http://gomiso.com/oauth/request_token";
|
||||||
|
private static final String ACCESS_TOKEN_RESOURCE = "http://gomiso.com/oauth/access_token";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return ACCESS_TOKEN_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return REQUEST_TOKEN_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZE_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.Token;
|
||||||
|
|
||||||
|
public class NetProspexApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
private static final String REQUEST_TOKEN_URL = "https://api.netprospex.com/1.0/oauth/request-token";
|
||||||
|
private static final String ACCESS_TOKEN_URL = "https://api.netprospex.com/1.0/oauth/access-token";
|
||||||
|
private static final String AUTHORIZE_URL = "https://api.netprospex.com/1.0/oauth/authorize?oauth_token=%s";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return REQUEST_TOKEN_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return ACCESS_TOKEN_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZE_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.*;
|
||||||
|
|
||||||
|
public class Px500Api extends DefaultApi10a
|
||||||
|
{
|
||||||
|
private static final String AUTHORIZATION_URL = "https://api.500px.com/v1/oauth/authorize?oauth_token=%s";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "https://api.500px.com/v1/oauth/access_token";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "https://api.500px.com/v1/oauth/request_token";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZATION_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.extractors.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.utils.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renren(http://www.renren.com/) OAuth 2.0 based api.
|
||||||
|
*/
|
||||||
|
public class RenrenApi extends DefaultApi20
|
||||||
|
{
|
||||||
|
private static final String AUTHORIZE_URL = "https://graph.renren.com/oauth/authorize?client_id=%s&redirect_uri=%s&response_type=code";
|
||||||
|
private static final String SCOPED_AUTHORIZE_URL = AUTHORIZE_URL + "&scope=%s";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessTokenExtractor getAccessTokenExtractor()
|
||||||
|
{
|
||||||
|
return new JsonTokenExtractor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "https://graph.renren.com/oauth/token?grant_type=authorization_code";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(OAuthConfig config)
|
||||||
|
{
|
||||||
|
// Append scope if present
|
||||||
|
if (config.hasScope())
|
||||||
|
{
|
||||||
|
return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.extractors.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.utils.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SinaWeibo OAuth 2.0 api.
|
||||||
|
*/
|
||||||
|
public class SinaWeiboApi20 extends DefaultApi20
|
||||||
|
{
|
||||||
|
private static final String AUTHORIZE_URL = "https://api.weibo.com/oauth2/authorize?client_id=%s&redirect_uri=%s&response_type=code";
|
||||||
|
private static final String SCOPED_AUTHORIZE_URL = AUTHORIZE_URL + "&scope=%s";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Verb getAccessTokenVerb()
|
||||||
|
{
|
||||||
|
return Verb.POST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessTokenExtractor getAccessTokenExtractor()
|
||||||
|
{
|
||||||
|
return new JsonTokenExtractor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return "https://api.weibo.com/oauth2/access_token?grant_type=authorization_code";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(OAuthConfig config)
|
||||||
|
{
|
||||||
|
// Append scope if present
|
||||||
|
if (config.hasScope())
|
||||||
|
{
|
||||||
|
return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth API for Skyrock.
|
||||||
|
*
|
||||||
|
* @author Nicolas Quiénot
|
||||||
|
* @see <a href="http://www.skyrock.com/developer/">Skyrock.com API</a>
|
||||||
|
*/
|
||||||
|
public class SkyrockApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
private static final String API_ENDPOINT = "https://api.skyrock.com/v2";
|
||||||
|
private static final String REQUEST_TOKEN_RESOURCE = "/oauth/initiate";
|
||||||
|
private static final String AUTHORIZE_URL = "/oauth/authorize?oauth_token=%s";
|
||||||
|
private static final String ACCESS_TOKEN_RESOURCE = "/oauth/token";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return API_ENDPOINT + ACCESS_TOKEN_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return API_ENDPOINT + REQUEST_TOKEN_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(API_ENDPOINT + AUTHORIZE_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.scribe.builder.api;
|
||||||
|
|
||||||
|
import org.scribe.model.Token;
|
||||||
|
|
||||||
|
public class TumblrApi extends DefaultApi10a
|
||||||
|
{
|
||||||
|
private static final String AUTHORIZE_URL = "https://www.tumblr.com/oauth/authorize?oauth_token=%s";
|
||||||
|
private static final String REQUEST_TOKEN_RESOURCE = "http://www.tumblr.com/oauth/request_token";
|
||||||
|
private static final String ACCESS_TOKEN_RESOURCE = "http://www.tumblr.com/oauth/access_token";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTokenEndpoint()
|
||||||
|
{
|
||||||
|
return ACCESS_TOKEN_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRequestTokenEndpoint()
|
||||||
|
{
|
||||||
|
return REQUEST_TOKEN_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthorizationUrl(Token requestToken)
|
||||||
|
{
|
||||||
|
return String.format(AUTHORIZE_URL, requestToken.getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ import org.scribe.services.*;
|
|||||||
|
|
||||||
public class YammerApi extends DefaultApi10a
|
public class YammerApi extends DefaultApi10a
|
||||||
{
|
{
|
||||||
private static final String AUTHORIZATION_URL = "'https://www.yammer.com/oauth/authorize?oauth_token=%s'";
|
private static final String AUTHORIZATION_URL = "https://www.yammer.com/oauth/authorize?oauth_token=%s";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRequestTokenEndpoint()
|
public String getRequestTokenEndpoint()
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.scribe.exceptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: Pablo Fernandez
|
||||||
|
*/
|
||||||
|
public class OAuthConnectionException extends OAuthException
|
||||||
|
{
|
||||||
|
private static final String MSG = "There was a problem while creating a connection to the remote service.";
|
||||||
|
|
||||||
|
public OAuthConnectionException(Exception e)
|
||||||
|
{
|
||||||
|
super(MSG, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ package org.scribe.exceptions;
|
|||||||
public class OAuthSignatureException extends OAuthException
|
public class OAuthSignatureException extends OAuthException
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static final String MSG = "Error while signing string: %s";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -17,7 +18,7 @@ public class OAuthSignatureException extends OAuthException
|
|||||||
*/
|
*/
|
||||||
public OAuthSignatureException(String stringToSign, Exception e)
|
public OAuthSignatureException(String stringToSign, Exception e)
|
||||||
{
|
{
|
||||||
super("Error while signing string: " + stringToSign, e);
|
super(String.format(MSG, stringToSign), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ import org.scribe.utils.*;
|
|||||||
public class TokenExtractorImpl implements RequestTokenExtractor, AccessTokenExtractor
|
public class TokenExtractorImpl implements RequestTokenExtractor, AccessTokenExtractor
|
||||||
{
|
{
|
||||||
private static final Pattern TOKEN_REGEX = Pattern.compile("oauth_token=([^&]+)");
|
private static final Pattern TOKEN_REGEX = Pattern.compile("oauth_token=([^&]+)");
|
||||||
private static final Pattern SECRET_REGEX = Pattern.compile("oauth_token_secret=([^&]+)");
|
private static final Pattern SECRET_REGEX = Pattern.compile("oauth_token_secret=([^&]*)");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class OAuthConfig
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// do nothing.
|
throw new RuntimeException("there were problems while writting to the debug stream", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.scribe.model;
|
package org.scribe.model;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -63,14 +61,7 @@ public class ParameterList
|
|||||||
|
|
||||||
public String asOauthBaseString()
|
public String asOauthBaseString()
|
||||||
{
|
{
|
||||||
try
|
return OAuthEncoder.encode(asFormUrlEncodedString());
|
||||||
{
|
|
||||||
return URLEncoder.encode(asFormUrlEncodedString(), "UTF8");
|
|
||||||
}
|
|
||||||
catch (UnsupportedEncodingException uee)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String asFormUrlEncodedString()
|
public String asFormUrlEncodedString()
|
||||||
|
|||||||
@@ -61,13 +61,9 @@ class Request
|
|||||||
createConnection();
|
createConnection();
|
||||||
return doSend();
|
return doSend();
|
||||||
}
|
}
|
||||||
catch (UnknownHostException uhe)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new OAuthException("Could not reach the desired host. Check your network connection.", uhe);
|
throw new OAuthConnectionException(e);
|
||||||
}
|
|
||||||
catch (IOException ioe)
|
|
||||||
{
|
|
||||||
throw new OAuthException("Problems while creating connection.", ioe);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.io.*;
|
|||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.scribe.exceptions.*;
|
||||||
import org.scribe.utils.*;
|
import org.scribe.utils.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,8 +32,7 @@ public class Response
|
|||||||
}
|
}
|
||||||
catch (UnknownHostException e)
|
catch (UnknownHostException e)
|
||||||
{
|
{
|
||||||
code = 404;
|
throw new OAuthException("The IP address of a host could not be determined.", e);
|
||||||
body = Response.EMPTY;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,4 +57,22 @@ public class Token implements Serializable
|
|||||||
{
|
{
|
||||||
return String.format("Token[%s , %s]", token, secret);
|
return String.format("Token[%s , %s]", token, secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the token is empty (token = "", secret = "")
|
||||||
|
*/
|
||||||
|
public boolean isEmpty()
|
||||||
|
{
|
||||||
|
return "".equals(this.token) && "".equals(this.secret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory method that returns an empty token (token = "", secret = "").
|
||||||
|
*
|
||||||
|
* Useful for two legged OAuth.
|
||||||
|
*/
|
||||||
|
public static Token empty()
|
||||||
|
{
|
||||||
|
return new Token("","");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -88,8 +88,12 @@ public class OAuth10aServiceImpl implements OAuthService
|
|||||||
public void signRequest(Token token, OAuthRequest request)
|
public void signRequest(Token token, OAuthRequest request)
|
||||||
{
|
{
|
||||||
config.log("signing request: " + request.getCompleteUrl());
|
config.log("signing request: " + request.getCompleteUrl());
|
||||||
request.addOAuthParameter(OAuthConstants.TOKEN, token.getToken());
|
|
||||||
|
|
||||||
|
// Do not append the token if empty. This is for two legged OAuth calls.
|
||||||
|
if (!token.isEmpty())
|
||||||
|
{
|
||||||
|
request.addOAuthParameter(OAuthConstants.TOKEN, token.getToken());
|
||||||
|
}
|
||||||
config.log("setting token to: " + token);
|
config.log("setting token to: " + token);
|
||||||
addOAuthParams(request, token);
|
addOAuthParams(request, token);
|
||||||
appendSignature(request);
|
appendSignature(request);
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package org.scribe.services;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.*;
|
||||||
|
import org.scribe.exceptions.*;
|
||||||
|
import java.security.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signature service that uses the RSA-SHA1 algorithm.
|
||||||
|
*/
|
||||||
|
public class RSASha1SignatureService implements SignatureService
|
||||||
|
{
|
||||||
|
private static final String METHOD = "RSA-SHA1";
|
||||||
|
private static final String RSA_SHA1 = "SHA1withRSA";
|
||||||
|
|
||||||
|
private PrivateKey privateKey;
|
||||||
|
|
||||||
|
public RSASha1SignatureService(PrivateKey privateKey)
|
||||||
|
{
|
||||||
|
this.privateKey = privateKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public String getSignature(String baseString, String apiSecret, String tokenSecret)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Signature signature = Signature.getInstance(RSA_SHA1);
|
||||||
|
signature.initSign(privateKey);
|
||||||
|
signature.update(baseString.getBytes());
|
||||||
|
return new String(Base64.encodeBase64(signature.sign(), false));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new OAuthSignatureException(baseString, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public String getSignatureMethod()
|
||||||
|
{
|
||||||
|
return METHOD;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,9 @@ import org.scribe.model.OAuthConstants;
|
|||||||
public class Preconditions
|
public class Preconditions
|
||||||
{
|
{
|
||||||
private static final String DEFAULT_MESSAGE = "Received an invalid parameter";
|
private static final String DEFAULT_MESSAGE = "Received an invalid parameter";
|
||||||
private static final Pattern URL_PATTERN = Pattern.compile("[a-zA-Z_-]+://\\S+");
|
|
||||||
|
// scheme = alpha *( alpha | digit | "+" | "-" | "." )
|
||||||
|
private static final Pattern URL_PATTERN = Pattern.compile("^[a-zA-Z][a-zA-Z0-9+.-]*://\\S+");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that an object is not null.
|
* Checks that an object is not null.
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ public class ServiceBuilderTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void shouldNotAcceptAnInvalidUrlAsCallback()
|
public void shouldNotAcceptNullAsCallback()
|
||||||
{
|
{
|
||||||
builder.provider(ApiMock.class).apiKey("key").apiSecret("secret").callback("example.com").build();
|
builder.provider(ApiMock.class).apiKey("key").apiSecret("secret").callback(null).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
|
||||||
|
public class DiggExample
|
||||||
|
{
|
||||||
|
private static final String NETWORK_NAME = "Digg";
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "http://services.digg.com/2.0/comment.digg";
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
// Replace these with your own api key and secret
|
||||||
|
String apiKey = "myKey";
|
||||||
|
String apiSecret = "mySecret";
|
||||||
|
OAuthService service = new ServiceBuilder().provider(DiggApi.class).apiKey(apiKey).apiSecret(apiSecret).build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Request Token
|
||||||
|
System.out.println("Fetching the Request Token...");
|
||||||
|
Token requestToken = service.getRequestToken();
|
||||||
|
System.out.println("Got the Request Token!");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Authorization URL
|
||||||
|
System.out.println("Fetching the Authorization URL...");
|
||||||
|
String authorizationUrl = service.getAuthorizationUrl(requestToken);
|
||||||
|
System.out.println("Got the Authorization URL!");
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
System.out.println(authorizationUrl);
|
||||||
|
System.out.println("And paste the authorization code here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verfier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(requestToken, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.POST, PROTECTED_RESOURCE_URL);
|
||||||
|
request.addBodyParameter("comment_id", "20100729223726:4fef610331ee46a3b5cbd740bf71313e");
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getCode());
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class FlickrExample
|
||||||
|
{
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "http://api.flickr.com/services/rest/";
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
// Replace these with your own api key and secret
|
||||||
|
String apiKey = "your_app_id";
|
||||||
|
String apiSecret = "your_api_secret";
|
||||||
|
OAuthService service = new ServiceBuilder().provider(FlickrApi.class).apiKey(apiKey).apiSecret(apiSecret).build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== Flickr's OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Request Token
|
||||||
|
System.out.println("Fetching the Request Token...");
|
||||||
|
Token requestToken = service.getRequestToken();
|
||||||
|
System.out.println("Got the Request Token!");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
String authorizationUrl = service.getAuthorizationUrl(requestToken);
|
||||||
|
System.out.println(authorizationUrl + "&perms=read");
|
||||||
|
System.out.println("And paste the verifier here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verfier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(requestToken, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
|
||||||
|
request.addQuerystringParameter("method", "flickr.test.login");
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
|
||||||
|
public class FreelancerExample
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final String NETWORK_NAME = "Freelancer";
|
||||||
|
private static final String AUTHORIZE_URL = "http://www.sandbox.freelancer.com/users/api-token/auth.php?oauth_token=";
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "http://api.sandbox.freelancer.com/Job/getJobList.json";
|
||||||
|
private static final String SCOPE = "http://api.sandbox.freelancer.com";
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
OAuthService service = new ServiceBuilder()
|
||||||
|
.provider(FreelancerApi.Sandbox.class)
|
||||||
|
.signatureType(SignatureType.QueryString)
|
||||||
|
.apiKey("7f5a168a0bfdbd15b4a9ea2a969661c731cdea56")
|
||||||
|
.apiSecret("7bb8961b94873802f1c5344f671a518e087f5785")
|
||||||
|
.scope(SCOPE)
|
||||||
|
.build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Request Token
|
||||||
|
System.out.println("Fetching the Request Token...");
|
||||||
|
Token requestToken = service.getRequestToken();
|
||||||
|
System.out.println("Got the Request Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + requestToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
System.out.println(AUTHORIZE_URL + requestToken.getToken());
|
||||||
|
System.out.println("And paste the verifier here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verfier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(requestToken, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
request.addHeader("GData-Version", "3.0");
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getCode());
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class ImgUrExample
|
||||||
|
{
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "http://api.imgur.com/2/account.json";
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
// Replace these with your own api key and secret (you'll need an read/write api key)
|
||||||
|
String apiKey = "your_app_id";
|
||||||
|
String apiSecret = "your_api_secret";
|
||||||
|
OAuthService service = new ServiceBuilder().provider(ImgUrApi.class).apiKey(apiKey).apiSecret(apiSecret).build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== ImgUr's OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Request Token
|
||||||
|
System.out.println("Fetching the Request Token...");
|
||||||
|
Token requestToken = service.getRequestToken();
|
||||||
|
System.out.println("Got the Request Token!");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
String authorizationUrl = service.getAuthorizationUrl(requestToken);
|
||||||
|
System.out.println(authorizationUrl);
|
||||||
|
System.out.println("And paste the verifier here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verfier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(requestToken, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class Kaixin20Example
|
||||||
|
{
|
||||||
|
private static final String NETWORK_NAME = "Kaixin";
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "https://api.kaixin001.com/users/me.json";
|
||||||
|
private static final Token EMPTY_TOKEN = null;
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
// Replace these with your own api key and secret
|
||||||
|
String apiKey = "your api key";
|
||||||
|
String apiSecret = "your api secret";
|
||||||
|
OAuthService service = new ServiceBuilder()
|
||||||
|
.provider(KaixinApi20.class)
|
||||||
|
.apiKey(apiKey)
|
||||||
|
.apiSecret(apiSecret)
|
||||||
|
.callback("http://your.domain.com/handle")
|
||||||
|
.build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Authorization URL
|
||||||
|
System.out.println("Fetching the Authorization URL...");
|
||||||
|
String authorizationUrl = service.getAuthorizationUrl(EMPTY_TOKEN);
|
||||||
|
System.out.println("Got the Authorization URL!");
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
System.out.println(authorizationUrl);
|
||||||
|
System.out.println("And paste the authorization code here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verifier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getCode());
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.scribe.builder.ServiceBuilder;
|
||||||
|
import org.scribe.builder.api.MeetupApi;
|
||||||
|
import org.scribe.model.OAuthRequest;
|
||||||
|
import org.scribe.model.Response;
|
||||||
|
import org.scribe.model.Token;
|
||||||
|
import org.scribe.model.Verb;
|
||||||
|
import org.scribe.model.Verifier;
|
||||||
|
import org.scribe.oauth.OAuthService;
|
||||||
|
|
||||||
|
public class MeetupExample
|
||||||
|
{
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "http://api.meetup.com/2/member/self";
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
OAuthService service = new ServiceBuilder()
|
||||||
|
.provider(MeetupApi.class)
|
||||||
|
.apiKey("j1khkp0dus323ftve0sdcv6ffe")
|
||||||
|
.apiSecret("6s6gt6q59gvfjtsvgcmht62gq4")
|
||||||
|
.build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== Meetup's OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Request Token
|
||||||
|
System.out.println("Fetching the Request Token...");
|
||||||
|
Token requestToken = service.getRequestToken();
|
||||||
|
System.out.println("Got the Request Token!");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
System.out.println(service.getAuthorizationUrl(requestToken));
|
||||||
|
System.out.println("And paste the verifier here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verfier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(requestToken, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
|
||||||
|
public class Px500Example
|
||||||
|
{
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "https://api.500px.com/v1/";
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
OAuthService service = new ServiceBuilder()
|
||||||
|
.provider(Px500Api.class)
|
||||||
|
.apiKey("your-api-key")
|
||||||
|
.apiSecret("your-api-secret")
|
||||||
|
.build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== 500Px's OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Request Token
|
||||||
|
System.out.println("Fetching the Request Token...");
|
||||||
|
Token requestToken = service.getRequestToken();
|
||||||
|
System.out.println("Got the Request Token!");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
System.out.println(service.getAuthorizationUrl(requestToken));
|
||||||
|
System.out.println("And paste the verifier here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verfier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(requestToken, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
import java.nio.charset.*;
|
||||||
|
import java.security.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class RenrenExample
|
||||||
|
{
|
||||||
|
private static final String NETWORK_NAME = "Renren";
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "http://api.renren.com/restserver.do";
|
||||||
|
private static final Token EMPTY_TOKEN = null;
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
// Replace these with your own api key and secret
|
||||||
|
String apiKey = "your api key";
|
||||||
|
String apiSecret = "your api secret";
|
||||||
|
OAuthService service = new ServiceBuilder()
|
||||||
|
.provider(RenrenApi.class)
|
||||||
|
.apiKey(apiKey)
|
||||||
|
.apiSecret(apiSecret)
|
||||||
|
.scope("status_update publish_feed")
|
||||||
|
.callback("http://your.doman.com/oauth/renren")
|
||||||
|
.build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Authorization URL
|
||||||
|
System.out.println("Fetching the Authorization URL...");
|
||||||
|
String authorizationUrl = service.getAuthorizationUrl(EMPTY_TOKEN);
|
||||||
|
System.out.println("Got the Authorization URL!");
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
System.out.println(authorizationUrl);
|
||||||
|
System.out.println("And paste the authorization code here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verfier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.POST, PROTECTED_RESOURCE_URL);
|
||||||
|
Map<String, String> parameters = new HashMap<String, String>();
|
||||||
|
parameters.put("method", "users.getInfo");
|
||||||
|
parameters.put("format", "json");
|
||||||
|
parameters.put("v", "1.0");
|
||||||
|
|
||||||
|
List<String> sigString = new ArrayList<String>(parameters.size() + 1);
|
||||||
|
for (Map.Entry<String, String> entry : parameters.entrySet())
|
||||||
|
{
|
||||||
|
request.addQuerystringParameter(entry.getKey(), entry.getValue());
|
||||||
|
sigString.add(String.format("%s=%s", entry.getKey(), entry.getValue()));
|
||||||
|
}
|
||||||
|
sigString.add(String.format("%s=%s", OAuthConstants.ACCESS_TOKEN, accessToken.getToken()));
|
||||||
|
Collections.sort(sigString);
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
for (String param : sigString)
|
||||||
|
{
|
||||||
|
b.append(param);
|
||||||
|
}
|
||||||
|
b.append(apiSecret);
|
||||||
|
System.out.println("Sig string: " + b.toString());
|
||||||
|
request.addQuerystringParameter("sig", md5(b.toString()));
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getCode());
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String md5(String orgString)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
java.security.MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
byte[] array = md.digest(orgString.getBytes(Charset.forName("UTF-8")));
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
for (int i = 0; i < array.length; ++i)
|
||||||
|
{
|
||||||
|
sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
catch (NoSuchAlgorithmException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class SinaWeibo2Example
|
||||||
|
{
|
||||||
|
private static final String NETWORK_NAME = "SinaWeibo";
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "https://api.weibo.com/2/account/get_uid.json";
|
||||||
|
private static final Token EMPTY_TOKEN = null;
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
// Replace these with your own api key and secret
|
||||||
|
String apiKey = "your_api_key";
|
||||||
|
String apiSecret = "your_api_secret";
|
||||||
|
OAuthService service = new ServiceBuilder()
|
||||||
|
.provider(SinaWeiboApi20.class)
|
||||||
|
.apiKey(apiKey)
|
||||||
|
.apiSecret(apiSecret)
|
||||||
|
.callback("http://www.dajie.com/oauth/sina")
|
||||||
|
.build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Authorization URL
|
||||||
|
System.out.println("Fetching the Authorization URL...");
|
||||||
|
String authorizationUrl = service.getAuthorizationUrl(EMPTY_TOKEN);
|
||||||
|
System.out.println("Got the Authorization URL!");
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
System.out.println(authorizationUrl);
|
||||||
|
System.out.println("And paste the authorization code here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verifier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getCode());
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.scribe.examples;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.scribe.builder.*;
|
||||||
|
import org.scribe.builder.api.*;
|
||||||
|
import org.scribe.model.*;
|
||||||
|
import org.scribe.oauth.*;
|
||||||
|
|
||||||
|
public class SkyrockExample
|
||||||
|
{
|
||||||
|
private static final String PROTECTED_RESOURCE_URL = "https://api.skyrock.com/v2/user/get.json";
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
OAuthService service = new ServiceBuilder()
|
||||||
|
.provider(SkyrockApi.class)
|
||||||
|
.apiKey("your-api-key")
|
||||||
|
.apiSecret("your-api-secret")
|
||||||
|
.build();
|
||||||
|
Scanner in = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("=== Skyrock's OAuth Workflow ===");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Obtain the Request Token
|
||||||
|
System.out.println("Fetching the Request Token...");
|
||||||
|
Token requestToken = service.getRequestToken();
|
||||||
|
System.out.println("Got the Request Token!");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("Now go and authorize Scribe here:");
|
||||||
|
System.out.println(service.getAuthorizationUrl(requestToken));
|
||||||
|
System.out.println("And paste the verifier here");
|
||||||
|
System.out.print(">>");
|
||||||
|
Verifier verifier = new Verifier(in.nextLine());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Trade the Request Token and Verfier for the Access Token
|
||||||
|
System.out.println("Trading the Request Token for an Access Token...");
|
||||||
|
Token accessToken = service.getAccessToken(requestToken, verifier);
|
||||||
|
System.out.println("Got the Access Token!");
|
||||||
|
System.out.println("(if your curious it looks like this: " + accessToken + " )");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// Now let's go and ask for a protected resource!
|
||||||
|
System.out.println("Now we're going to access a protected resource...");
|
||||||
|
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
|
||||||
|
service.signRequest(accessToken, request);
|
||||||
|
Response response = request.send();
|
||||||
|
System.out.println("Got it! Lets see what we found...");
|
||||||
|
System.out.println();
|
||||||
|
System.out.println(response.getCode());
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -44,6 +44,15 @@ public class TokenExtractorTest
|
|||||||
assertEquals("hdhd0244k9j7ao03", extracted.getSecret());
|
assertEquals("hdhd0244k9j7ao03", extracted.getSecret());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldExtractTokenWithEmptySecret()
|
||||||
|
{
|
||||||
|
String response = "oauth_token=hh5s93j4hdidpola&oauth_token_secret=";
|
||||||
|
Token extracted = extractor.extract(response);
|
||||||
|
assertEquals("hh5s93j4hdidpola", extracted.getToken());
|
||||||
|
assertEquals("", extracted.getSecret());
|
||||||
|
}
|
||||||
|
|
||||||
@Test(expected = OAuthException.class)
|
@Test(expected = OAuthException.class)
|
||||||
public void shouldThrowExceptionIfTokenIsAbsent()
|
public void shouldThrowExceptionIfTokenIsAbsent()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package org.scribe.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import org.junit.*;
|
||||||
|
import org.apache.commons.codec.binary.*;
|
||||||
|
import java.security.*;
|
||||||
|
import java.security.spec.*;
|
||||||
|
|
||||||
|
public class RSASha1SignatureServiceTest
|
||||||
|
{
|
||||||
|
|
||||||
|
RSASha1SignatureService service = new RSASha1SignatureService(getPrivateKey());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldReturnSignatureMethodString()
|
||||||
|
{
|
||||||
|
String expected = "RSA-SHA1";
|
||||||
|
assertEquals(expected, service.getSignatureMethod());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldReturnSignature()
|
||||||
|
{
|
||||||
|
String apiSecret = "api secret";
|
||||||
|
String tokenSecret = "token secret";
|
||||||
|
String baseString = "base string";
|
||||||
|
String signature = "LUNRzQAlpdNyM9mLXm96Va6g/qVNnEAb7p7K1KM0g8IopOFQJPoOO7cvppgt7w3QyhijWJnCmvqXaaIAGrqvdyr3fIzBULh8D/iZQUNLMi08GCOA34P81XBvsc7A5uJjPDsGhJg2MzoVJ8nWJhU/lMMk4c92S1WGskeoDofRwpo=";
|
||||||
|
assertEquals(signature, service.getSignature(baseString, apiSecret, tokenSecret));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Created primary key using openssl.
|
||||||
|
*
|
||||||
|
* openssl req -x509 -nodes -days 365 -newkey rsa:1024 -sha1 -subj '/C=GB/ST=/L=Manchester/CN=www.example.com' -keyout myrsakey.pem -out /tmp/myrsacert.pem
|
||||||
|
* openssl pkcs8 -in myrsakey.pem -topk8 -nocrypt -out myrsakey.pk8
|
||||||
|
*/
|
||||||
|
private static PrivateKey getPrivateKey()
|
||||||
|
{
|
||||||
|
String str = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMPQ5BCMxlUq2TYy\n"+
|
||||||
|
"iRIoEUsz6HGTJhHuasS2nx1Se4Co3lxwxyubVdFj8AuhHNJSmJvjlpbTsGOjLZpr\n"+
|
||||||
|
"HyDEDdJmf1Fensh1MhUnBZ4a7uLrZrKzFHHJdamX9pxapB89vLeHlCot9hVXdrZH\n"+
|
||||||
|
"nNtg6FdmRKH/8gbs8iDyIayFvzYDAgMBAAECgYA+c9MpTBy9cQsR9BAvkEPjvkx2\n"+
|
||||||
|
"XL4ZnfbDgpNA4Nuu7yzsQrPjPomiXMNkkiAFHH67yVxwAlgRjyuuQlgNNTpKvyQt\n"+
|
||||||
|
"XcHxffnU0820VmE23M+L7jg2TlB3+rUnEDmDvCoyjlwGDR6lNb7t7Fgg2iR+iaov\n"+
|
||||||
|
"0iVzz+l9w0slRlyGsQJBAPWXW2m3NmFgqfDxtw8fsKC2y8o17/cnPjozRGtWb8LQ\n"+
|
||||||
|
"g3VCb8kbOFHOYNGazq3M7+wD1qILF2h/HecgK9eQrZ0CQQDMHXoJMfKKbrFrTKgE\n"+
|
||||||
|
"zyggO1gtuT5OXYeFewMEb5AbDI2FfSc2YP7SHij8iQ2HdukBrbTmi6qxh3HmIR58\n"+
|
||||||
|
"I/AfAkEA0Y9vr0tombsUB8cZv0v5OYoBZvCTbMANtzfb4AOHpiKqqbohDOevLQ7/\n"+
|
||||||
|
"SpvgVCmVaDz2PptcRAyEBZ5MCssneQJAB2pmvaDH7Ambfod5bztLfOhLCtY5EkXJ\n"+
|
||||||
|
"n6rZcDbRaHorRhdG7m3VtDKOUKZ2DF7glkQGV33phKukErVPUzlHBwJAScD9TqaG\n"+
|
||||||
|
"wJ3juUsVtujV23SnH43iMggXT7m82STpPGam1hPfmqu2Z0niePFo927ogQ7H1EMJ\n"+
|
||||||
|
"UHgqXmuvk2X/Ww==";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
KeyFactory fac = KeyFactory.getInstance("RSA");
|
||||||
|
PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(str.getBytes()));
|
||||||
|
return fac.generatePrivate(privKeySpec);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,16 +43,25 @@ public class PreconditionsTest
|
|||||||
Preconditions.checkValidUrl(null, ERROR_MSG);
|
Preconditions.checkValidUrl(null, ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void shouldAllowValidUrls()
|
public void shouldAllowValidUrls()
|
||||||
{
|
{
|
||||||
Preconditions.checkValidUrl("http://www.example.com", ERROR_MSG);
|
Preconditions.checkValidUrl("http://www.example.com", ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void shouldAllowSSLUrls()
|
public void shouldAllowSSLUrls()
|
||||||
{
|
{
|
||||||
Preconditions.checkValidUrl("https://www.example.com", ERROR_MSG);
|
Preconditions.checkValidUrl("https://www.example.com", ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldAllowSpecialCharsInScheme()
|
||||||
|
{
|
||||||
|
Preconditions.checkValidUrl("custom+9.3-1://www.example.com", ERROR_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void shouldAllowNonStandarProtocolsForAndroid()
|
public void shouldAllowNonStandarProtocolsForAndroid()
|
||||||
{
|
{
|
||||||
Preconditions.checkValidUrl("x-url-custom://www.example.com", ERROR_MSG);
|
Preconditions.checkValidUrl("x-url-custom://www.example.com", ERROR_MSG);
|
||||||
@@ -64,6 +73,13 @@ public class PreconditionsTest
|
|||||||
Preconditions.checkValidUrl("$weird*://www.example.com", ERROR_MSG);
|
Preconditions.checkValidUrl("$weird*://www.example.com", ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
public void shouldNotAllowUnderscoreInScheme()
|
||||||
|
{
|
||||||
|
Preconditions.checkValidUrl("http_custom://www.example.com", ERROR_MSG);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void shouldAllowOutOfBandAsValidCallbackValue()
|
public void shouldAllowOutOfBandAsValidCallbackValue()
|
||||||
{
|
{
|
||||||
Preconditions.checkValidOAuthCallback("oob", ERROR_MSG);
|
Preconditions.checkValidOAuthCallback("oob", ERROR_MSG);
|
||||||
|
|||||||
Reference in new issue
Block a user