Commit 0b73599
Changed files (35)
app
channels
application_cable
controllers
helpers
jobs
mailers
config
db
app/channels/application_cable/channel.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
app/channels/application_cable/connection.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
app/controllers/concerns/saml_respondable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module SamlRespondable
extend ActiveSupport::Concern
@@ -17,7 +19,7 @@ module SamlRespondable
query_string = request.query_string
on = query_string.include?("&") ? "&" : "&"
result = Hash[query_string.split(on).map { |x| x.split("=", 2) }].symbolize_keys
- result.reject! { |key, value| !allowed_params.include?(key.to_sym) }
+ result.select! { |key, _value| allowed_params.include?(key.to_sym) }
result
end
end
app/controllers/scim/v2/resource_types_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Scim
module V2
class ResourceTypesController < ApplicationController
app/controllers/scim/v2/schemas_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Scim
module V2
class SchemasController < ApplicationController
app/controllers/scim/v2/search_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Scim
module V2
class SearchController < ::Scim::Controller
app/controllers/scim/v2/service_providers_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Scim
module V2
class ServiceProvidersController < ::Scim::Controller
app/controllers/scim/v2/users_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Scim
module V2
class UsersController < ::Scim::Controller
app/controllers/scim/controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Scim
class Controller < ApplicationController
protect_from_forgery with: :null_session
@@ -6,8 +8,7 @@ module Scim
private
- def authenticate!
- end
+ def authenticate!; end
def not_found
render json: {
app/controllers/application_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ApplicationController < ActionController::Base
include SamlRespondable
protect_from_forgery with: :exception
app/controllers/dashboards_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DashboardsController < ApplicationController
def show
@metadatum = Saml::Kit.registry.to_a
app/controllers/metadata_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class MetadataController < ApplicationController
force_ssl if: :ssl_configured?
skip_before_action :authenticate!
app/controllers/registrations_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RegistrationsController < ApplicationController
skip_before_action :authenticate!
app/controllers/sessions_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class SessionsController < ApplicationController
skip_before_action :verify_authenticity_token, only: [:new, :destroy]
skip_before_action :authenticate!, only: [:new, :create, :destroy]
@@ -11,7 +13,7 @@ class SessionsController < ApplicationController
else
render_error(:forbidden, model: @saml_request)
end
- rescue => error
+ rescue StandardError => error
logger.error(error)
end
@@ -54,7 +56,6 @@ class SessionsController < ApplicationController
end
reset_session
redirect_to new_session_path
- else
end
end
app/helpers/application_helper.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
module ApplicationHelper
end
app/jobs/application_job.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
class ApplicationJob < ActiveJob::Base
end
app/mailers/application_mailer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
app/models/application_record.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
app/models/bearer_token.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class BearerToken
def initialize(private_key = Rails.application.config.x.jwt.private_key)
@private_key = private_key
@@ -9,8 +11,8 @@ class BearerToken
end
def decode(token)
- JWT.decode(token, public_key, true, { algorithm: 'RS256' })[0].with_indifferent_access
- rescue
+ JWT.decode(token, public_key, true, algorithm: 'RS256')[0].with_indifferent_access
+ rescue StandardError
{}
end
app/models/idp.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Idp
class << self
def default(request)
app/models/user.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class User < ApplicationRecord
has_secure_password
validates :email, presence: true, email: true, uniqueness: true
after_initialize do
- self.uuid = SecureRandom.uuid unless self.uuid
+ self.uuid = SecureRandom.uuid unless uuid
end
def name_id_for(name_id_format)
app/models/user_mapper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UserMapper
def initialize(url_helpers)
@url_helpers = url_helpers
app/models/user_repository.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UserRepository
attr_reader :mapper
config/brakeman
@@ -0,0 +1,1 @@
+---
db/migrate/20171021193946_create_users.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
db/migrate/20171111230910_add_sessions_table.rb
@@ -1,12 +1,14 @@
+# frozen_string_literal: true
+
class AddSessionsTable < ActiveRecord::Migration[4.2]
def change
create_table :sessions do |t|
- t.string :session_id, :null => false
+ t.string :session_id, null: false
t.text :data
t.timestamps
end
- add_index :sessions, :session_id, :unique => true
+ add_index :sessions, :session_id, unique: true
add_index :sessions, :updated_at
end
end
db/migrate/20180113222024_add_lock_version_to_users.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddLockVersionToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :lock_version, :bigint, default: 0, null: false
db/seeds.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
test/application_system_test_case.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
test/test_helper.rb
@@ -1,4 +1,6 @@
-require File.expand_path('../../config/environment', __FILE__)
+# frozen_string_literal: true
+
+require File.expand_path('../config/environment', __dir__)
require 'rails/test_help'
class ActiveSupport::TestCase
.rubocop.yml
@@ -0,0 +1,45 @@
+# For a list of available cops see:
+# https://github.com/bbatsov/rubocop/blob/master/config/default.yml
+AllCops:
+ TargetRubyVersion:
+ 2.5
+ Exclude:
+ - 'bin/**/*'
+ - 'config/**/*'
+ - 'db/schema.rb'
+ - 'db/seeds.rb'
+ - 'node_modules/**/*'
+ - 'spec/**/*'
+ - 'test/**/*'
+ - 'tmp/**/*'
+ - 'vendor/**/*'
+
+Metrics/AbcSize:
+ Enabled: false
+
+Metrics/MethodLength:
+ Enabled: false
+
+Metrics/PerceivedComplexity:
+ Enabled: false
+
+Style/Documentation:
+ Enabled: false
+
+Style/RaiseArgs:
+ EnforcedStyle: compact
+
+Style/StringLiterals:
+ Enabled: false
+
+Style/SymbolArray:
+ Enabled: false
+
+Style/TrailingCommaInArrayLiteral:
+ Enabled: false
+
+Style/TrailingCommaInHashLiteral:
+ Enabled: false
+
+Style/TrailingCommaInArguments:
+ Enabled: false
.ruby-version
@@ -0,0 +1,1 @@
+2.5.0
config.ru
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# This file is used by Rack-based servers to start the application.
require_relative 'config/environment'
Gemfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
source 'https://rubygems.org'
git_source(:github) do |repo_name|
@@ -12,7 +14,7 @@ gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
-#gem 'uglifier', '>= 1.3.0'
+# gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
@@ -35,23 +37,23 @@ group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
- gem 'selenium-webdriver'
- gem 'rspec-rails', '~> 3.6'
+ gem 'factory_bot_rails'
gem 'ffaker'
- gem 'webmock'
gem 'rails-controller-testing'
+ gem 'rspec-rails', '~> 3.6'
+ gem 'selenium-webdriver'
gem 'sqlite3'
- gem 'factory_bot_rails'
+ gem 'webmock'
end
group :development do
- gem 'web-console', '>= 3.3.0'
+ gem 'brakeman'
+ gem 'bundler-audit'
gem 'listen', '>= 3.0.5', '< 3.2'
+ gem 'rubocop'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
- gem 'bundler-audit'
- gem 'brakeman'
- gem 'rubocop'
+ gem 'web-console', '>= 3.3.0'
end
group :production do
@@ -60,14 +62,14 @@ group :production do
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
-gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
-gem 'dotenv-rails'
-gem 'saml-kit', '~> 1.0'
-gem 'rails-assets-jquery', source: 'https://rails-assets.org'
-gem 'rails-assets-bootstrap', source: 'https://rails-assets.org'
-gem 'jwt'
gem 'activerecord-session_store'
+gem 'dotenv-rails'
gem "email_validator"
+gem 'jwt'
+gem 'rails-assets-bootstrap', source: 'https://rails-assets.org'
+gem 'rails-assets-jquery', source: 'https://rails-assets.org'
+gem 'saml-kit', '~> 1.0'
gem 'scim-shady', '~> 0.2'
gem 'spank'
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'webpacker'
Rakefile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.