class Vidibus::Realm::Rack
Attributes
app[R]
env[R]
Public Class Methods
new(app)
click to toggle source
# File lib/vidibus/realm/rack.rb, line 8 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/vidibus/realm/rack.rb, line 12 def call(env) @env = env env[:realm] = realm app.call(env) end
Protected Instance Methods
realm()
click to toggle source
Returns realm from constant or subdomain.
# File lib/vidibus/realm/rack.rb, line 34 def realm defined?(VIDIBUS_REALM) ? VIDIBUS_REALM : subdomain end
subdomain()
click to toggle source
Returns current subdomain which is, for now, the realm uuid itself. The hostname must match the current service's domain because it may contain several subdomains as well which are not suitable for identifying the current realm.
# File lib/vidibus/realm/rack.rb, line 24 def subdomain env["SERVER_NAME"].match(/(.+)\.#{::Service.this.domain}/) $1 rescue Vidibus::Service::ConfigurationError unless env['PATH_INFO'] == '/connector' raise(ServiceError, 'This service has not been configured yet') end end