repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/document_spec.rb | spec/models/document_spec.rb | # frozen_string_literal: true
RSpec.describe Document, type: :model do
## Test of relationships
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(:create_member_permission) do
create :permission,
role: 'member'
end
it { should belong_to(:user) }
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/phone_spec.rb | spec/models/phone_spec.rb | # frozen_string_literal: true
RSpec.describe Phone, type: :model do
let!(:create_member_permission) do
create :permission,
role: 'member'
end
context 'submasked fields' do
let!(:phone) { create(:phone) }
context 'number' do
it 'should mask country code and last 4 digits' do
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/ability_spec.rb | spec/models/ability_spec.rb | # frozen_string_literal: true
describe Ability do
before do
allow(Ability).to receive(:admin_permissions).and_return({
"superadmin"=>{"manage"=>["User", "Activity", "Ability", "APIKey", "Profile", "Permission", "Label", "Restriction", "Level"]},
"admin"=>{"read"=>["Level", "APIKey", "Permission"], "... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/level_spec.rb | spec/models/level_spec.rb | # frozen_string_literal: true
RSpec.describe Level, type: :model do
it { should validate_presence_of(:key) }
it { should validate_presence_of(:value) }
it { should validate_presence_of(:description) }
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/profile_spec.rb | spec/models/profile_spec.rb | # frozen_string_literal: true
RSpec.describe Profile, type: :model do
describe 'squish_spaces' do
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:profile) do
create :profile, first_name: ' First Name ',
last_name: ' Last... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/activity_spec.rb | spec/models/activity_spec.rb | # frozen_string_literal: true
RSpec.describe Activity, type: :model do
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:activity) do
create :activity, topic: 'session',
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/api_key_spec.rb | spec/models/api_key_spec.rb | # frozen_string_literal: true
RSpec.describe APIKey, type: :model do
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:create_service_account_permission) do
create :permission,
role: 'service_account'
end
describe 'Validations' do
subject(:api... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/restrictions_spec.rb | spec/models/restrictions_spec.rb | # frozen_string_literal: true
RSpec.describe Restriction, type: :model do
context 'create' do
it { should_not allow_value('planet').for(:scope) }
it 'valid address with ip scope' do
expect(Restriction.new(scope: 'ip', value: '127.0.0.1', category: 'blacklist').valid?).to be_truthy
end
it 'inv... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/label_spec.rb | spec/models/label_spec.rb | # frozen_string_literal: true
RSpec.describe Label, type: :model do
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(:create_member_permission) do
create :permission,
role: 'member'
end
it { should belong_to(:user) }
describe 'update user level if ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/models/user_spec.rb | spec/models/user_spec.rb | # frozen_string_literal: true
RSpec.describe User, type: :model do
before { allow(Barong::App.config).to receive_messages(kyc_provider: 'local') }
let!(:create_member_permission) do
create :permission,
role: 'member'
end
context 'User model basic syntax' do
## Test of data length
it { s... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/base_spec.rb | spec/api/base_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::Base do
describe 'API::Base' do
it 'should exist' do
expect(API::Base).to eq(API::Base)
end
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/profiles_spec.rb | spec/api/v2/management/profiles_spec.rb | # frozen_string_literal: true
require 'rails_helper'
describe API::V2::Management::Profiles, type: :request do
before do
defaults_for_management_api_v2_security_configuration!
management_api_v2_security_configuration.merge! \
scopes: {
read_users: { permitted_signers: %i[alex jeff], mandatory_... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/api_keys_spec.rb | spec/api/v2/management/api_keys_spec.rb | # frozen_string_literal: true
describe API::V2::Management::APIKeys, type: :request do
before do
defaults_for_management_api_v2_security_configuration!
management_api_v2_security_configuration.merge! \
scopes: {
write_apikeys: { permitted_signers: %i[alex jeff], mandatory_signers: %i[alex] },
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/jwt_authentication_middleware_spec.rb | spec/api/v2/management/jwt_authentication_middleware_spec.rb | # frozen_string_literal: true
require 'rails_helper'
describe API::V2::Management::JWTAuthenticationMiddleware, type: :request do
let(:member) { create(:member, :verified_identity) }
let(:config) { management_api_v2_security_configuration }
before do
defaults_for_management_api_v2_security_configur... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/service_accounts_spec.rb | spec/api/v2/management/service_accounts_spec.rb | # frozen_string_literal: true
require 'rails_helper'
require 'pry'
describe API::V2::Management::ServiceAccounts, type: :request do
before do
defaults_for_management_api_v2_security_configuration!
management_api_v2_security_configuration.merge! \
scopes: {
read_service_accounts: { permitted_si... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/users_spec.rb | spec/api/v2/management/users_spec.rb | # frozen_string_literal: true
require 'rails_helper'
require 'pry'
describe API::V2::Management::Users, type: :request do
before do
defaults_for_management_api_v2_security_configuration!
management_api_v2_security_configuration.merge! \
scopes: {
read_users: { permitted_signers: %i[a... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/phones_spec.rb | spec/api/v2/management/phones_spec.rb | # frozen_string_literal: true
describe API::V2::Management::Phones, type: :request do
before do
defaults_for_management_api_v2_security_configuration!
management_api_v2_security_configuration.merge! \
scopes: {
write_phones: { permitted_signers: %i[alex jeff], mandatory_signers: %i[alex] },
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/labels_spec.rb | spec/api/v2/management/labels_spec.rb | # frozen_string_literal: true
require 'rails_helper'
require 'pry'
describe API::V2::Management::Labels, type: :request do
before do
defaults_for_management_api_v2_security_configuration!
management_api_v2_security_configuration.merge! \
scopes: {
write_labels: { permitted_signers: ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/otp_spec.rb | spec/api/v2/management/otp_spec.rb | # frozen_string_literal: true
require 'rails_helper'
require 'pry'
describe API::V2::Management::Otp, type: :request do
before do
defaults_for_management_api_v2_security_configuration!
management_api_v2_security_configuration.merge! \
scopes: {
otp_sign: { permitted_signers: %i[alex jeff], man... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/management/documents_spec.rb | spec/api/v2/management/documents_spec.rb | # frozen_string_literal: true
require 'rails_helper'
describe API::V2::Management::Documents, type: :request do
before do
defaults_for_management_api_v2_security_configuration!
management_api_v2_security_configuration.merge! \
scopes: {
write_documents: { permitted_signers: %i[alex jeff], mand... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/auth/rbac_spec.rb | spec/api/v2/auth/rbac_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe '/api/v2/auth functionality test' do
include_context 'geoip mock'
let(:do_protected_request) { get '/api/v2/auth/api/v2/resource/users/me' }
describe 'testing rbac workability' do
before(:example) do
Thread.list.last.kill if Thread.list.la... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/auth/csrf_spec.rb | spec/api/v2/auth/csrf_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe '/api/v2/auth CSRF functionality test' do
include_context 'geoip mock'
before do
allow_any_instance_of(Barong::Authorize).to receive(:validate_csrf!).and_call_original
end
let(:uri) { '/api/v2/identity/sessions' }
let!(:create_permissions) do... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/auth/auth_spec.rb | spec/api/v2/auth/auth_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe '/api/v2/auth functionality test' do
include_context 'geoip mock'
let(:uri) { '/api/v2/identity/sessions' }
let!(:create_permissions) do
create :permission, role: 'admin'
create :permission, role: 'member', action: 'ACCEPT', verb: 'all', path... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/auth/audit_spec.rb | spec/api/v2/auth/audit_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe '/api/v2/auth functionality test' do
include_context 'geoip mock'
before do
end
before do
create :permission, role: 'admin', action: 'AUDIT', verb: 'put', path: 'api/v2/admin/users'
create :permission, role: 'member'
create :permission, ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/auth/sessions_spec.rb | spec/api/v2/auth/sessions_spec.rb | # frozen_string_literal: true
require 'spec_helper'
include ActiveSupport::Testing::TimeHelpers
describe '/api/v2/auth functionality test' do
include_context 'geoip mock'
let(:session_expire_time) do
Barong::App.config.session_expire_time.to_i.seconds
end
let!(:create_permissions) do
create :permissi... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/auth/restriction_spec.rb | spec/api/v2/auth/restriction_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe '/api/v2/auth functionality test' do
include_context 'geoip mock'
let(:uri) { '/api/v2/identity/sessions' }
let!(:create_permissions) do
create :permission, role: 'member', action: 'ACCEPT', verb: 'all', path: 'tasty_endpoint'
Rails.cache.del... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/profiles_spec.rb | spec/api/v2/resource/profiles_spec.rb | # frozen_string_literal: true
describe 'API::V2::Resource::Profiles' do
before { allow(Barong::App.config).to receive_messages(kyc_provider: 'local') }
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:optional_params) do
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/data_storage_spec.rb | spec/api/v2/resource/data_storage_spec.rb | # frozen_string_literal: true
describe 'Api::V2::Resource::DataStorage' do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
describe 'POST /api/v2/resource/data_storage' do
let(:url) { '/api/v2/resource/data_storage' }
co... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/api_keys_spec.rb | spec/api/v2/resource/api_keys_spec.rb | # frozen_string_literal: true
describe 'Api::V2::APIKeys' do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(:test_user) { create(:use... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/service_accounts_spec.rb | spec/api/v2/resource/service_accounts_spec.rb | # frozen_string_literal: true
describe 'Api::V2::Resource::ServiceAccounts' do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:create_service_account_permission) do
create :permission,
role: 'service_account'
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/users_spec.rb | spec/api/v2/resource/users_spec.rb | # frozen_string_literal: true
describe 'Api::V1::Profiles' do
include_context 'bearer authentication'
include_context 'geoip mock'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
describe 'GET /api/v2/resource/users/me' do
it 'should reply permissions denied' do
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/phones_spec.rb | spec/api/v2/resource/phones_spec.rb | # frozen_string_literal: true
describe 'Api::V2::Resources::Phones' do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
context 'Twilio Verify Service' do
before do
allow(Barong::App.config).to receive(:twilio_provider).a... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/labels_spec.rb | spec/api/v2/resource/labels_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'Labels API.' do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let(:post_pa... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/otp_spec.rb | spec/api/v2/resource/otp_spec.rb | # frozen_string_literal: true
describe 'Api::V2::Resource::Otp' do
include_context 'bearer authentication'
include_context 'geoip mock'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:do_request) { post '/api/v2/resource/otp/enable', headers: auth_header }
let... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/documents_spec.rb | spec/api/v2/resource/documents_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'Documents API test' do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:image) { fixture_file_upload('/files/documents_test.jpg', 'image/jpg') }
describe 'POST... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/resource/addresses_spec.rb | spec/api/v2/resource/addresses_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'Addresses API test' do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:image) { fixture_file_upload('/files/documents_test.jpg', 'image/jpg') }
before do
a... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/entities/user_with_full_spec.rb | spec/api/v2/entities/user_with_full_spec.rb | # frozen_string_literal: true
describe API::V2::Entities::UserWithKYC do
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:record) { create(:user) }
subject { OpenStruct.new API::V2::Entities::UserWithKYC.represent(record).serializable_hash }
it { expect(subject.... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/entities/labels_spec.rb | spec/api/v2/entities/labels_spec.rb | # frozen_string_literal: true
describe API::V2::Entities::Label do
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:record) { create(:label) }
subject { OpenStruct.new API::V2::Entities::Label.represent(record).serializable_hash }
it { expect(subject.key).to eq ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/entities/activities_spec.rb | spec/api/v2/entities/activities_spec.rb | # frozen_string_literal: true
describe API::V2::Entities::Activity do
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:record) { create(:activity, topic: 'otp', result: 'succeed', action: 'login') }
subject { OpenStruct.new API::V2::Entities::Activity.represent(rec... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/profiles_spec.rb | spec/api/v2/admin/profiles_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Admin::Profiles do
include_context 'bearer authentication'
let!(:create_admin_permission) do
create :permission,
role: 'admin'
create :permission,
role: 'superadmin'
end
let!(:create_member_permission) do
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/api_keys_spec.rb | spec/api/v2/admin/api_keys_spec.rb | # frozen_string_literal: true
describe 'Api::V2::Admin::APIKeys' do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:create_superadmin_permission) do
create :permission,
role: 'superadmin'
end
describe 'G... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/permissions_spec.rb | spec/api/v2/admin/permissions_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Admin::Permissions do
include_context 'bearer authentication'
let!(:create_admin_permission) { create(:permission, role: 'superadmin', action: 'accept', verb: 'get') }
let!(:test_user) { create(:user, role: 'superadmin') }
let!(:create_memb... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/metrics_spec.rb | spec/api/v2/admin/metrics_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Admin::Metrics do
include_context 'bearer authentication'
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(:create_member_permission) do
create :permission,
role: 'member'
end
de... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/levels_spec.rb | spec/api/v2/admin/levels_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Admin::Levels do
include_context 'bearer authentication'
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(:create_member_permission) do
create :permission,
role: 'member'
end
des... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/users_spec.rb | spec/api/v2/admin/users_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Admin::Users do
include_context 'bearer authentication'
let!(:create_admin_permission) do
create :permission,
role: 'admin'
create :permission,
role: 'superadmin'
end
let!(:create_member_permission) do
creat... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | true |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/restrictions_spec.rb | spec/api/v2/admin/restrictions_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Admin::Restrictions do
include_context 'bearer authentication'
before { create(:permission, role: 'superadmin') }
let!(:test_user) { create(:user, role: 'superadmin') }
describe 'GET /api/v2/admin/restrictions' do
before do
creat... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/activities_spec.rb | spec/api/v2/admin/activities_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Admin::Activities do
include_context 'bearer authentication'
include_context 'geoip mock'
describe 'GET /api/v2/admin/activities' do
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/admin/abilities_spec.rb | spec/api/v2/admin/abilities_spec.rb | # frozen_string_literal: true
describe API::V2::Admin::Abilities, type: :request do
include_context 'bearer authentication'
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(:create_member_permission) do
create :permission,
role: 'member'
end
descr... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/public/general_spec.rb | spec/api/v2/public/general_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Public::General do
describe 'GET /api/v2/public/time' do
it 'returns a server status' do
get '/api/v2/public/ping'
expect_status_to_eq(200)
expect(json_body[:ping]).to eq('pong')
end
end
describe 'GET /api/v2/public... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/cors/validations_spec.rb | spec/api/v2/cors/validations_spec.rb | # encoding: UTF-8
# frozen_string_literal: true
describe Barong::CORS::Validations do
describe 'validate origins' do
subject { Barong::CORS::Validations.validate_origins(ENV['API_CORS_ORIGINS']) }
context 'set API_CORS_ORIGINS as "*"' do
before do
ENV['API_CORS_ORIGINS'] = '*'
end
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/cors/cors_spec.rb | spec/api/v2/cors/cors_spec.rb | # encoding: UTF-8
# frozen_string_literal: true
require 'rack/cors'
require 'env-tweaks'
describe Rack::Cors, type: :request do
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:member) { create(:member, :level_3) }
let(:fro... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/queries/activity_filter_spec.rb | spec/api/v2/queries/activity_filter_spec.rb | # frozen_string_literal: true
describe API::V2::Queries::ActivityFilter do
let(:initial_scope) { Activity.all }
let(:params) {{topic: 'session', action: 'login', uid: 'UI12345'}}
subject { described_class.new(initial_scope).call(params) }
it 'filters by uid and action' do
case ActiveRecord::Base.connectio... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/identity/general_spec.rb | spec/api/v2/identity/general_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe API::V2::Identity::General do
describe 'GET /api/v2/identity/time' do
it 'returns a server status' do
get '/api/v2/identity/ping'
expect_status_to_eq(200)
expect(json_body[:ping]).to eq('pong')
end
end
describe 'GET /api/v2/... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/identity/users_spec.rb | spec/api/v2/identity/users_spec.rb | # frozen_string_literal: true
require 'spec_helper'
include ActiveSupport::Testing::TimeHelpers
describe API::V2::Identity::Users do
include_context 'geoip mock'
before do
allow(Barong::App.config).to receive_messages(first_registration_superadmin: false)
end
let!(:create_member_permission) do
creat... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/api/v2/identity/sessions_spec.rb | spec/api/v2/identity/sessions_spec.rb | # frozen_string_literal: true
describe API::V2::Identity::Sessions do
include_context 'geoip mock'
include ActiveSupport::Testing::TimeHelpers
let!(:create_member_permission) do
create :permission,
role: 'member',
verb: 'all'
end
before do
Rails.cache.delete('permissions')
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/lib/barong/jwt_spec.rb | spec/lib/barong/jwt_spec.rb | # frozen_string_literal: true
require_dependency 'barong/jwt'
describe Barong::JWT do
let(:key) { OpenSSL::PKey::RSA.generate(2048) }
it 'should encode payload with claims' do
codec = Barong::JWT.new(key: key)
token = codec.encode({hello: 'world'})
decoded = ::JWT.decode(token, key.public_key,
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/lib/barong/seed_spec.rb | spec/lib/barong/seed_spec.rb | # frozen_string_literal: true
require_dependency 'barong/seed'
describe "Default seeds.yml template" do
let(:seeds) { Barong::Seed.new.seeds }
it "Generate seed using environement variables" do
expect(ENV).to receive(:fetch).with("BARONG_ADMIN_EMAIL", "admin@barong.io").and_call_original
expect(ENV).to r... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/lib/barong/redis_session_spec.rb | spec/lib/barong/redis_session_spec.rb | # frozen_string_literal: true
describe Barong::RedisSession do
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let!(:user) { create(:user) }
let!(:session_id) { SecureRandom.hex(16) }
let!(:hash_sid) { Barong::RedisSession.hexdigest_session(session_id) }
let!(:encr... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/mailers/postmaster_spec.rb | spec/mailers/postmaster_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Postmaster, type: :mailer do
let!(:create_admin_permission) do
create :permission,
role: 'admin'
end
let!(:create_member_permission) do
create :permission,
role: 'member'
end
describe '#process_payload' do
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/mailers/previews/mailer_preview.rb | spec/mailers/previews/mailer_preview.rb | # frozen_string_literal: true
# Preview all emails at http://localhost:3000/rails/mailers/mailer
class MailerPreview < ActionMailer::Preview
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/jwt.rb | lib/barong/jwt.rb | module Barong
class JWT
def initialize(options)
raise "Missing private key" unless options[:key]
@options = options.reverse_merge({
algoritm: 'RS256',
expire: Barong::App.config.jwt_expire_time,
sub: 'session',
iss: 'barong',
aud: %w[peatio barong]
})
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/middleware.rb | lib/barong/middleware.rb | # frozen_string_literal: true
require 'barong/middleware/jwt_authenticator'
module Barong
# Barong Rack middlewares
module Middleware; end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/authorize.rb | lib/barong/authorize.rb | # frozen_string_literal: true
require 'barong/activity_logger'
module Barong
# AuthZ functionality
class Authorize
STATE_CHANGING_VERBS = %w[POST PUT PATCH DELETE TRACE].freeze
# Custom Error class to support error status and message
class AuthError < StandardError
attr_reader :code
# ini... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/seed.rb | lib/barong/seed.rb | module Barong
class Seed
class ConfigError < RuntimeError; end
def initialize
@result = []
end
def seeds
YAML.safe_load(
ERB.new(
File.read(
Barong::App.config.seeds_file
)
).result
)
end
def inspect
str = "Seeded users... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/json_log_formatter.rb | lib/barong/json_log_formatter.rb | # frozen_string_literal: true
# json formatter for logs
class JSONLogFormatter < ::Logger::Formatter
def call(severity, time, _progname, msg)
JSON.dump(level: severity, time: time, message: msg) + "\n"
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/mock_sms.rb | lib/barong/mock_sms.rb | # frozen_string_literal: true
module Barong
# empty sms service
class MockSMS
cattr_accessor :messages
self.messages = []
def initialize(_account_sid, _auth_token) end
def messages
self
end
def create(params)
self.class.messages << OpenStruct.new(params)
end
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/redis_session.rb | lib/barong/redis_session.rb | # frozen_string_literal: true
module Barong
class RedisSession
def self.hexdigest_session(session_id)
Digest::SHA256.hexdigest(session_id.to_s)
end
# We have session stored in redis
# Like _session_id:2::value
def self.encrypted_session(session_id)
"_session_id:2::#{hexdigest_session... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/keystore.rb | lib/barong/keystore.rb | # frozen_string_literal: true
module Barong
class KeyStore
class Fatal < StandardError; end
def initialize(private_key)
OpenSSL::PKey.read(private_key).tap do |key|
@private_key = key
@public_key = key.public_key
end
end
def public_key
@public_key
end
def... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/activity_logger.rb | lib/barong/activity_logger.rb | # frozen_string_literal: true
module Barong
# admin activities log writer class
class ActivityLogger
ACTION = { post: 'create', put: 'update', get: 'read', delete: 'delete', patch: 'update' }.freeze
def self.async_write(options = {})
@activities ||= Queue.new
@activities.push(options)
@... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/app.rb | lib/barong/app.rb | # frozen_string_literal: true
module Barong
class App
include ActiveSupport::Configurable
class Error < ::StandardError; end
class << self
def define
yield self
end
def set(key, default = nil, options = {})
value = fetch!(key, default)
validate!(key, value, o... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/geo_ip.rb | lib/barong/geo_ip.rb | # frozen_string_literal: true
module Barong
# MaxmindDB reader adapter
module GeoIP
class << self
attr_accessor :lang
# Usage: city = Barong::GeoIP.info(ip: ip, key: :city)
def info(ip:, key:)
record = reader.get(ip)
return unless record
case key.to_sym
when :c... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/event_api.rb | lib/barong/event_api.rb | # frozen_string_literal: true
require 'active_support/concern'
require 'active_support/lazy_load_hooks'
# EventAPI provides interface to platform-wide notifications in RabbitMQ.
#
# Check docs/specs/event_api.md for more details.
module EventAPI
class << self
def notify(event_name, event_payload)
argument... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/middleware/jwt_authenticator.rb | lib/barong/middleware/jwt_authenticator.rb | # frozen_string_literal: true
module Barong
module Middleware
# Authenticate a user by a bearer token
class JWTAuthenticator < Grape::Middleware::Base
def initialize(app, options)
super(app, options)
raise(Peatio::Auth::Error, 'Public key missing') unless options[:pubkey]
@keyp... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/cors/validations.rb | lib/barong/cors/validations.rb | # frozen_string_literal: true
# Provides CORS variables validation.
module Barong
module CORS
# Main CORS policy logic
module Validations
Error = Class.new(StandardError)
class << self
def validate_origins(origins)
origins.split(',').each_with_object([]) do |origin, domains|
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/lib/barong/auth0/jwt.rb | lib/barong/auth0/jwt.rb | # frozen_string_literal: true
module Barong
module Auth0
class JWT
def self.verify(token)
::JWT.decode(token,
nil,
true, # Verify the signature of this token
algorithms: 'RS256',
iss: "https://#{Barong:... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/application.rb | config/application.rb | # frozen_string_literal: true
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Barong
class Application < Rails::Application
# Initialize configuration defaults for... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/environment.rb | config/environment.rb | # Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/puma.rb | config/puma.rb | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/routes.rb | config/routes.rb | Rails.application.routes.draw do
match '/api/v2/auth/*path', to: AuthorizeController.action(:authorize), via: :all
mount API::Base, at: '/api'
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/spring.rb | config/spring.rb | %w[
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
].each { |path| Spring.watch(path) }
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/boot.rb | config/boot.rb | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += %i[password upload]
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/user_storage_titles.rb | config/initializers/user_storage_titles.rb | # frozen_string_literal: true
# whitelisted data storage titles definitions
class UserStorageTitles
class << self
def list
@list ||= YAML.load_file(Barong::App.config.config)['user_storage_titles'] || []
end
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/exception_reporting.rb | config/initializers/exception_reporting.rb | def catch_and_report_exception(options = {})
begin
yield
nil
rescue options.fetch(:class) { StandardError } => e
report_exception(e)
e
end
end
def report_exception(exception, report_to_ets = true)
report_exception_to_screen(exception)
report_exception_to_ets(exception) if report_to_ets
end
d... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/application_controller_renderer.rb | config/initializers/application_controller_renderer.rb | # Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/redis_store.rb | config/initializers/redis_store.rb | # frozen_string_literal: true
module Rack
module Session
# redis store configuration class to act as session_store (cache_store)
class Redis
def set_session(env, session_id, new_session, options)
with_lock env, false do
with do |c|
new_options = if env['api_v2.session_life... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/barong.rb | config/initializers/barong.rb | # frozen_string_literal: true
# 1/ check if ENV key exist then validate and set
# 2/ if no check in credentials then validate and set
# 3/ if no generate display warning, raise error in production, and set
require 'barong/app'
require 'barong/keystore'
private_key_path = ENV['JWT_PRIVATE_KEY_PATH']
if !private_key... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/redis.rb | config/initializers/redis.rb | # frozen_string_literal: true
begin
if Rails.env.production?
redis_url = ENV.fetch('BARONG_REDIS_URL', 'redis://localhost:6379/1')
r = Redis.new(url: redis_url)
r.ping
end
rescue Redis::CannotConnectError
Rails.logger.fatal("Error connecting to Redis on #{redis_url} (Errno::ECONNREFUSED)")
raise 'F... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/sidekiq.rb | config/initializers/sidekiq.rb | # frozen_string_literal: true
Sidekiq.configure_server do |config|
config.redis = { url: ENV.fetch('BARONG_REDIS_URL', 'redis://localhost:6379/1') }
end
Sidekiq.configure_client do |config|
config.redis = { url: ENV.fetch('BARONG_REDIS_URL', 'redis://localhost:6379/1') }
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/vault.rb | config/initializers/vault.rb | # frozen_string_literal: true
require 'vault/rails'
Vault::Rails.configure do |config|
config.enabled = Rails.env.production?
config.address = Barong::App.config.vault_address
config.token = Barong::App.config.vault_token
config.ssl_verify = false
config.timeout = 60
config.application = Barong::App.confi... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/barong_config.rb | config/initializers/barong_config.rb | # FIXME BarongConfig should be a feature of Barong::App
class BarongConfig
class << self
def list
@hash ||= read_from_yaml
end
private
def read_from_yaml
conf = YAML.load_file(Barong::App.config.config)
conf['activation_requirements'] = {'email' => 'verified'} unless conf['activat... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/trusted_proxies.rb | config/initializers/trusted_proxies.rb | # Extend default list of trusted proxies with generic private and cloudflare proxy list
# Cloudflare proxies list
# config/cloudflare_ips.yml fetches every time you build an image. Check Dockerfile l54, l55
cloudflare_ips = File.read('config/cloudflare_ips.yml').split(/\R+/)
extend_proxies = cloudflare_ips.map { |prox... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/document_types.rb | config/initializers/document_types.rb | # frozen_string_literal: true
# document types definitions
class DocumentTypes
class << self
def list
@list ||= YAML.load_file(Barong::App.config.config)['document_types']
end
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/sessions_store.rb | config/initializers/sessions_store.rb | # frozen_string_literal: true
# Use cache_store as session_store for Rails sessions. Key default is '_barong_session'
Rails.application.config.session_store :cache_store, key: Barong::App.config.session_name, expire_after: 24.hours.seconds
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/wrap_parameters.rb | config/initializers/wrap_parameters.rb | # Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/inflections.rb | config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/cookies_serializer.rb | config/initializers/cookies_serializer.rb | # Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.signed_cookie_digest = 'SHA256'
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/assets.rb | config/initializers/assets.rb | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/config/initializers/phone.rb | config/initializers/phone.rb | # frozen_string_literal: true
require_dependency 'barong/mock_sms'
Barong::App.define do |config|
# Twilio configuration ----------------------
# https://www.openware.com/sdk/docs/barong/configuration.html#twilio-configuration
config.write(:twilio_provider, TwilioSmsSendService)
config.set(:phone_verificati... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.