tcell_hooks 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3dc93257910a02bee3060b4ce189b7cbbe6aaf02
4
+ data.tar.gz: d6183a5a1236b361112ac52c19d5520e6a771990
5
+ SHA512:
6
+ metadata.gz: 250395b5fddcd845725a5185e1c49c64c3745557d4549450c36d6fedcc14d715a7a6696b370036c01d671bfedba569c1f98cbda0b326deec9f6e7ac782d70b73
7
+ data.tar.gz: 8c7da756d0d9255415ad4a2c8b7bb9db2513ac6d2dac14a5dcab42e2db9bc6b0223aa2f72b44bd61fd1e2fff6813d139b53e96a6b9c264cf2d142c1d91fd3128
data/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ Copyright (C) 2016 tCell.io, Inc. - All Rights Reserved
2
+ Proprietary and confidential
3
+
4
+ http://choosealicense.com/licenses/no-license/
@@ -0,0 +1,54 @@
1
+ By [TCell](https://www.tcell.io/).
2
+
3
+ TCell Hooks is to be used in conjuction with the [tcell_agent](https://rubygems.org/gems/tcell_agent) to allow for custom event notifications of login failures and login successes.
4
+
5
+ ## Getting started
6
+
7
+ You can add it to your Gemfile with:
8
+
9
+ ```ruby
10
+ gem 'tcell_hooks'
11
+ ```
12
+
13
+ Then run `bundle install`
14
+
15
+ There are two options for calling the hooks from your application code:
16
+
17
+ By providing a Rails request object and having the TCell Agent extract the relevant details from it:
18
+
19
+ ```ruby
20
+ TCellAgent::Hooks::V1::Frameworks::Rails::Login.register_login_event(
21
+ TCellAgent::Hooks::V1::Login::LOGIN_SUCCESS,
22
+ rails_request,
23
+ "user's id",
24
+ user_valid=false
25
+ )
26
+ ```
27
+
28
+ Or by providing each individual piece of information required for the TCell event:
29
+
30
+ ```ruby
31
+ TCellAgent::Hooks::V1::Login.register_login_event(
32
+ TCellAgent::Hooks::V1::Login::LOGIN_SUCCESS,
33
+ "users session id",
34
+ "user agent from request",
35
+ "users referrer header",
36
+ "remote address",
37
+ ["array","of","header","names"],
38
+ "users id",
39
+ "document uri",
40
+ user_valid=false
41
+ )
42
+ ```
43
+
44
+ The available statuses are:
45
+
46
+ `TCellAgent::Hooks::V1::Login::LOGIN_SUCCESS`
47
+
48
+ `TCellAgent::Hooks::V1::Login::LOGIN_FAILURE`
49
+
50
+
51
+ ## Important Note
52
+
53
+ If the [tcell_agent](https://rubygems.org/gems/tcell_agent) is not installed or if it's disabled, this code will do nothing and should have no performance effect on your app.
54
+
@@ -0,0 +1,79 @@
1
+ module TCellAgent
2
+ module Hooks
3
+ module V1
4
+
5
+ module Frameworks
6
+ module Rails
7
+
8
+ # Report a Login event by providing a Rails request object
9
+ #
10
+ # ==== Examples
11
+ #
12
+ # TCellAgent::Hooks::V1::Frameworks::Rails::Login.register_login_event(
13
+ # TCellAgent::Hooks::V1::Login::LOGIN_SUCCESS,
14
+ # rails_request,
15
+ # "tcell@tcell.io",
16
+ # false
17
+ # )
18
+ #
19
+ # TCellAgent::Hooks::V1::Frameworks::Rails::Login.register_login_event(
20
+ # TCellAgent::Hooks::V1::Login::LOGIN_FAILURE,
21
+ # rails_request,
22
+ # "tcell@tcell.io",
23
+ # false
24
+ # )
25
+ module Login
26
+ def self.register_login_event(status, rails_request, user_id, user_valid=nil); end
27
+ end
28
+
29
+ end
30
+ end
31
+
32
+ module Login
33
+
34
+ LOGIN_SUCCESS = "success"
35
+ LOGIN_FAILURE = "failure"
36
+
37
+ # Report a Login event by providing all the necessary parameters for a TCell event
38
+ #
39
+ # ==== Examples
40
+ #
41
+ # TCellAgent::Hooks::V1::Login.register_login_event(
42
+ # TCellAgent::Hooks::V1::Login::LOGIN_SUCCESS,
43
+ # "124KDJFL3234",
44
+ # "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36",
45
+ # "http://192.168.99.100:3000/",
46
+ # "192.168.99.1",
47
+ # ["HOST", "USER_AGENT", "ACCEPT", "REFERER", "ACCEPT_ENCODING", "ACCEPT_LANGUAGE", "COOKIE"],
48
+ # "tcell@tcell.io",
49
+ # "/users/auth/doorkeeper/callbackuri",
50
+ # false
51
+ # )
52
+ #
53
+ # TCellAgent::Hooks::V1::Login.register_login_event(
54
+ # TCellAgent::Hooks::V1::Login::LOGIN_FAILURE,
55
+ # "124KDJFL3234",
56
+ # "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36",
57
+ # "http://192.168.99.100:3000/",
58
+ # "192.168.99.1",
59
+ # ["HOST", "USER_AGENT", "ACCEPT", "REFERER", "ACCEPT_ENCODING", "ACCEPT_LANGUAGE", "COOKIE"],
60
+ # "tcell@tcell.io",
61
+ # "/users/auth/doorkeeper/callbackuri",
62
+ # false
63
+ # )
64
+ def self.register_login_event(
65
+ status,
66
+ session_id,
67
+ user_agent,
68
+ referrer,
69
+ remote_addr,
70
+ header_keys,
71
+ user_id,
72
+ document_uri,
73
+ user_valid=nil)
74
+ end
75
+ end
76
+
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,3 @@
1
+ module TCellHooks
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,25 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require "tcell_hooks/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "tcell_hooks"
8
+ s.version = TCellHooks::VERSION
9
+ s.date = "2016-12-14"
10
+ s.summary = "Programmatic Hooks for TCell's Ruby agent"
11
+ s.description = "Allows custom event sending of events to tCell when tcell-agent is also running"
12
+ s.authors = ["Garrett Held", "Rafael Alba"]
13
+ s.email = ["garrett@tcell.io", "rafael@tcell.io"]
14
+ s.files = ["lib/tcell_hooks.rb"]
15
+
16
+ s.files = Dir[
17
+ "lib/tcell_hooks.rb",
18
+ "lib/tcell_hooks/version.rb",
19
+ "README*",
20
+ "LICENSE*",
21
+ "tcell_hooks.gemspec"
22
+ ]
23
+
24
+ s.require_paths = ["lib"]
25
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tcell_hooks
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Garrett Held
8
+ - Rafael Alba
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-12-14 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Allows custom event sending of events to tCell when tcell-agent is also
15
+ running
16
+ email:
17
+ - garrett@tcell.io
18
+ - rafael@tcell.io
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - lib/tcell_hooks.rb
24
+ - lib/tcell_hooks/version.rb
25
+ - README.md
26
+ - LICENSE
27
+ - tcell_hooks.gemspec
28
+ homepage:
29
+ licenses: []
30
+ metadata: {}
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project:
47
+ rubygems_version: 2.0.14.1
48
+ signing_key:
49
+ specification_version: 4
50
+ summary: Programmatic Hooks for TCell's Ruby agent
51
+ test_files: []