Created
December 4, 2008 16:15
-
-
Save julesfern/31978 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| before :ensure_signed, :only=>[:index] | |
| # All other actions require that the user be authenticated directly, rather than through the api. | |
| before :ensure_authenticated_personally, :exclude=>[:index] | |
| # Main action used for starting the authorisation process (desktop clients) and finishing it (web clients) | |
| def index | |
| only_provides :js, :xml, :yaml | |
| raise NotFound unless @authenticating_client = request.authenticating_client | |
| if request.token | |
| # If client and request key, give the activated token if it was activated. | |
| @token = MerbAuthSliceFullfat::Token.get_request_key_for_client(@authenticating_client, request.token) | |
| else | |
| # Generate a request key | |
| @token = MerbAuthSliceFullfat::Token.create_receipt(client) | |
| end | |
| # # Some kind of downright nasty fraudlent, mangled request. | |
| # # Probably sent by a circus clown who drinks too much. | |
| raise NotAcceptable unless @token | |
| # # Okay, no error raised. Gogo render. | |
| display @token, :index | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment