Skip to content

Commit

Permalink
First commit modeled after OmniAuth OAuth strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
lackstein committed May 18, 2016
0 parents commit 1943c20
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
52 changes: 52 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Metrics/AbcSize:
Enabled: false

Metrics/BlockNesting:
Max: 2

Metrics/LineLength:
AllowURI: true
Enabled: false

Metrics/MethodLength:
CountComments: false
Max: 10

Metrics/ParameterLists:
Max: 4
CountKeywordArgs: true

Style/AccessModifierIndentation:
EnforcedStyle: outdent

Style/CollectionMethods:
PreferredMethods:
map: 'collect'
reduce: 'inject'
find: 'detect'
find_all: 'select'

Style/Documentation:
Enabled: false

Style/DotPosition:
EnforcedStyle: trailing

Style/DoubleNegation:
Enabled: false

Style/FileName:
Exclude:
- 'lib/omniauth-oauth.rb'

Style/HashSyntax:
EnforcedStyle: hash_rockets

Style/Lambda:
Enabled: false

Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

Style/StringLiterals:
EnforcedStyle: double_quotes
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source "http://rubygems.org"

gemspec

gem "rake"

group :test do
gem "rack-test"
gem "rspec", "~> 3.2"
gem "rubocop", ">= 0.30", :platforms => [:ruby_19, :ruby_20, :ruby_21, :ruby_22]
end
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# OmniAuth Discourse
...
16 changes: 16 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new

begin
require "rubocop/rake_task"
RuboCop::RakeTask.new
rescue LoadError
task :rubocop do
$stderr.puts "Rubocop is disabled"
end
end

task :default => [:spec, :rubocop]
2 changes: 2 additions & 0 deletions lib/omniauth-discourse.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require "omniauth-discourse/version"
require "omniauth/strategies/discourse"
5 changes: 5 additions & 0 deletions lib/omniauth-discourse/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module OmniAuth
module Discourse
VERSION = "1.0.0"
end
end
13 changes: 13 additions & 0 deletions lib/omniauth/strategies/discourse.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require "omniauth"

module OmniAuth
module Strategies
class Discourse
include OmniAuth::Strategy

args [:sso_url, :sso_secret]
option :sso_url, nil
option :sso_secret, nil
end
end
end
20 changes: 20 additions & 0 deletions omniauth-discourse.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require File.expand_path("../lib/omniauth-discourse/version", __FILE__)

Gem::Specification.new do |gem|
gem.authors = ["Noah Lackstein"]
gem.email = ["[email protected]"]
gem.description = "A generic strategy for OmniAuth to authenticate against Discourse forum's SSO."
gem.summary = gem.description
gem.homepage = "https://github.com/lackstein/omniauth-discourse"
gem.license = "MIT"

gem.add_dependency "omniauth", "~> 1.0"
gem.add_development_dependency "bundler", "~> 1.9"

gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
gem.name = "omniauth-discourse"
gem.require_paths = ["lib"]
gem.version = OmniAuth::Discourse::VERSION
end

0 comments on commit 1943c20

Please sign in to comment.