Sha256: a04d1df47ea77a8ba32c6c4ca4e86272a7c2958ec10174490658192736b5897a
Contents?: true
Size: 1.59 KB
Versions: 5
Compression:
Stored size: 1.59 KB
Contents
# Lightweight example of an oauth2 provider used by the ruby client. class TestOAuth2Provider < FlexmlsApi::Authentication::BaseOAuth2Provider def initialize @authorization_uri = "https://test.fbsdata.com/r/oauth2" @access_uri = "https://api.test.fbsdata.com/v1/oauth2/grant" @redirect_uri = "https://exampleapp.fbsdata.com/oauth-callback" @client_id="example-id" @client_secret="example-password" @session_cache = {} end def redirect(url) # User redirected to url, signs in, and gets code sent to callback self.code="my_code" end def load_session() @session_cache["test_user_session"] end def save_session(session) @session_cache["test_user_session"] = session nil end def session_timeout; 7200; end end class TestCLIOAuth2Provider < FlexmlsApi::Authentication::BaseOAuth2Provider def initialize @authorization_uri = "https://test.fbsdata.com/r/oauth2" @access_uri = "https://api.test.fbsdata.com/v1/oauth2/grant" @client_id="example-id" @client_secret="example-secret" @username="example-user" @password="example-password" @session_cache = {} end def grant_type :password end def redirect(url) raise "Unsupported in oauth grant_type=password mode" end def load_session() @session_cache["test_user_session"] end def save_session(session) @session_cache["test_user_session"] = session nil end def session_timeout; 60; end end class InvalidAuth2Provider < FlexmlsApi::Authentication::BaseOAuth2Provider def grant_type :not_a_real_type end end
Version data entries
5 entries across 5 versions & 1 rubygems