Sha256: fcbbeda063df6a400484f397177e31b1216cc87b4f2f9e6b8728b31cc0c2a6e3

Contents?: true

Size: 937 Bytes

Versions: 2

Compression:

Stored size: 937 Bytes

Contents

## Installation

1. In your **Gemfile** add line ```gem 'proxy_auth'```
2. Run ```bundle install```
3. Set config/secrets.yml:
```
#!bash
proxy:
  token: SECRET_TOKEN
  url: http://HOST:PORT
service:
  name: SERVICE_NAME
  url: http://SERVICE_HOST:SERVICE_PORT
  version: API_VERSION
```
4. Initialize with command ```rails generate proxy_auth:install```
5. Secure your application. In file app/controllers/application_controller.rb
```
#!ruby
before_action :authenticate

protected

def authenticate
  authenticate_token || render_unauthorized
end

def authenticate_token
  authenticate_with_http_token do |token|
    ProxyAuth::Token.instance.valid? token
  end
end

def render_unauthorized
  render json: 'Bad credentials', status: 401
end
```
6. Add management routes
```
#!ruby
mount ProxyAuth::Engine => '/proxy'
```
7. Restart your Rails application.
8. Rake task for reconnecting to proxy: ```rake proxy_auth:register_service```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
proxy_auth-0.0.6 README.md
proxy_auth-0.0.5 README.md