Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.

Rails responder doesn't enforce token #2

Open
jsqu99 opened this issue Dec 10, 2013 · 2 comments
Open

Rails responder doesn't enforce token #2

jsqu99 opened this issue Dec 10, 2013 · 2 comments

Comments

@jsqu99
Copy link

jsqu99 commented Dec 10, 2013

@GeekOnCoffee and I looked at the rails responder code and it looks like it doesn't include any of the token enforcement code (among other omissions).

I don't believe it has any of the other add_(message|notification|etc) helpers either.

@phstc
Copy link
Member

phstc commented Dec 15, 2013

Hey @jsqu99

We have a sample Rails project echo_endpoint_rails using endpoint_base.

I did some tests using it, and it seems to be working.

$ ENDPOINT_KEY=12345 rails s
# ...

# valid token
$ curl -i -X POST -H "X-Augury-Token:12345" -H "Content-Type: application/json" -d '{"message_id": "123", "message": "echo:received", "payload": {}}' http://localhost:3000/

# => HTTP/1.1 200 OK
# => {"message_id":"123","received":{}}%

# invalid token
curl -i -X POST -H "X-Augury-Token:1234" -H "Content-Type: application/json" -d '{"message_id": "123", "message": "echo:received", "payload": {}}' http://localhost:3000/

# => HTTP/1.1 401 Unauthorized
# => {"text":"unauthorized"}%

The service received in the example above uses the new helper add_value.

def received
  add_value 'received', params[:payload]
  process_result 200
end

Are you getting errors?

@jsqu99
Copy link
Author

jsqu99 commented Dec 16, 2013

thanks for sharing. maybe i missed something. i'll check it out soon

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants