crowd-auth 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +6 -0
- data/Rakefile +2 -0
- data/crowd-auth.gemspec +23 -0
- data/lib/crowd-auth.rb +21 -0
- data/lib/crowd-auth/version.rb +5 -0
- metadata +72 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/crowd-auth.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "crowd-auth/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "crowd-auth"
|
7
|
+
s.version = Crowd::Auth::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Ian Meyer"]
|
10
|
+
s.email = ["ianmmeyer@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Simple authentication against Atlassian Crowd}
|
13
|
+
s.description = %q{Simple authentication against Atlassian Crowd}
|
14
|
+
|
15
|
+
s.rubyforge_project = "crowd-auth"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency('rest-client', '>= 1.6.1')
|
23
|
+
end
|
data/lib/crowd-auth.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
module Crowd
|
4
|
+
# This is some kind of comment
|
5
|
+
class Auth
|
6
|
+
attr_accessor :crowd_url, :crowd_app_name, :crowd_app_pass, :crowd_auth_uri
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
options.each { |key, value| instance_variable_set("@#{key}", value) }
|
10
|
+
@crowd_auth_uri ||= "/crowd/rest/usermanagement/latest/authentication"
|
11
|
+
end
|
12
|
+
|
13
|
+
def authenticate(username, password)
|
14
|
+
rest_client = RestClient::Resource.new "#{@crowd_url}?username=#{username}", :user => @crowd_app_name, :password => @crowd_app_pass
|
15
|
+
|
16
|
+
resp = rest_client[@crowd_auth_uri].post "{\"value\":\"#{password}\"}", :accept => "application/json", :content_type => "application/json"
|
17
|
+
|
18
|
+
return resp
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: crowd-auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.2
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ian Meyer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-02-20 00:00:00 -05:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rest-client
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 1.6.1
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
description: Simple authentication against Atlassian Crowd
|
28
|
+
email:
|
29
|
+
- ianmmeyer@gmail.com
|
30
|
+
executables: []
|
31
|
+
|
32
|
+
extensions: []
|
33
|
+
|
34
|
+
extra_rdoc_files: []
|
35
|
+
|
36
|
+
files:
|
37
|
+
- .gitignore
|
38
|
+
- Gemfile
|
39
|
+
- Rakefile
|
40
|
+
- crowd-auth.gemspec
|
41
|
+
- lib/crowd-auth.rb
|
42
|
+
- lib/crowd-auth/version.rb
|
43
|
+
has_rdoc: true
|
44
|
+
homepage: ""
|
45
|
+
licenses: []
|
46
|
+
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project: crowd-auth
|
67
|
+
rubygems_version: 1.5.2
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: Simple authentication against Atlassian Crowd
|
71
|
+
test_files: []
|
72
|
+
|