Skip to content

Commit 6524d6a

Browse files
committed
update README
1 parent 98caaef commit 6524d6a

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
# vestauth-ruby
22

3-
> TODO
3+
```
4+
bundle install vestauth
5+
```
6+
7+
```
8+
# app/controllers/application_controller.rb
9+
class ApplicationController < ActionController::Base
10+
before_action :verify_agent!
11+
helper_method :current_agent
12+
13+
private
14+
15+
def verify_agent!
16+
@current_agent ||= Vestauth.provider.verify(http_method: request.method, uri: request.original_url, headers: request.headers)
17+
rescue => e
18+
render json: { error: { status: 401, code: 401, message: e.message } }, status: 401
19+
end
20+
21+
def current_agent
22+
@current_agent
23+
end
24+
end
25+
```
426

527
## Development
628

0 commit comments

Comments
 (0)