source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/features/organisations/save_config_saml_app_spec.rb | Ruby | mit | 202 | master | 1,845 | require 'rails_helper'
RSpec.feature 'Save Config Saml App', type: :feature do
let(:org) { create(:organisation) }
let(:user) { create(:user) }
let(:app_name) { 'datadog' }
before do
sign_in(user)
end
scenario 'Load Present Configuration' do
url = Faker::Internet.url
saml_app = Datadog.new(org... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/features/organisations/update_spec.rb | Ruby | mit | 202 | master | 1,092 | require 'rails_helper'
RSpec.feature 'Update Organisation', type: :feature do
let!(:org) { create(:organisation) }
let(:org_data) { attributes_for(:organisation) }
let(:user) { create(:user) }
scenario 'Create an organisation successfully' do
sign_in(user)
visit organisation_path(org)
select Country... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/features/organisations/create_spec.rb | Ruby | mit | 202 | master | 1,060 | require 'rails_helper'
RSpec.feature 'Create Organisation', type: :feature do
let(:org_data) { attributes_for(:organisation) }
let(:user) { create(:user) }
scenario 'Create an organisation successfully' do
sign_in(user)
visit new_organisation_path
select Country.all.sample.name, from: 'organisation_co... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/features/organisations/setup_saml_spec.rb | Ruby | mit | 202 | master | 542 | require 'rails_helper'
RSpec.feature 'Setup SAML', type: :feature do
let!(:org) { create(:organisation) }
let(:user) { create(:user) }
scenario 'Should show a success message if SAML is setup' do
sign_in(user)
allow_any_instance_of(Organisation).to receive(:setup_saml_certs).and_return(true)
visit org... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/features/organisations/remove_user_saml_app_spec.rb | Ruby | mit | 202 | master | 833 | require 'rails_helper'
RSpec.feature 'Config Saml App', type: :feature do
let(:user) { create(:user) }
let(:users) { create_list(:user, 10) }
let(:org) { create(:organisation) }
before do
sign_in(user)
end
scenario 'Remove user from group' do
create(
:saml_app_config,
organisation: org... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/features/organisations/config_saml_app_spec.rb | Ruby | mit | 202 | master | 2,074 | require 'rails_helper'
RSpec.feature 'Config Saml App', type: :feature do
let(:org) { create(:organisation) }
let(:user) { create(:user) }
let(:saml_apps) { ENV['SAML_APPS'].split(',') }
before do
sign_in(user)
end
scenario 'Redirect to organisation detail if app not found' do
visit organisation_c... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/features/organisations/add_user_saml_app_spec.rb | Ruby | mit | 202 | master | 844 | require 'rails_helper'
RSpec.feature 'Config Saml App', type: :feature do
let(:user) { create(:user) }
let(:users) { create_list(:user, 10) }
let(:org) { create(:organisation) }
before do
sign_in(user)
end
scenario 'Add user to group' do
create(
:saml_app_config,
organisation: org,
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/features/organisations/list_user_saml_app_spec.rb | Ruby | mit | 202 | master | 2,061 | require 'rails_helper'
RSpec.feature 'Config Saml App', type: :feature do
let(:user) { create(:user) }
let(:users) { create_list(:user, 10) }
let(:org) { create(:organisation) }
before do
sign_in(user)
end
scenario 'Display list of users for the saml app' do
create(
:saml_app_config,
o... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/views/api_resources/edit.html.slim_spec.rb | Ruby | mit | 202 | master | 598 | require 'rails_helper'
RSpec.describe "api_resources/edit", type: :view do
before(:each) do
@api_resource = assign(:api_resource, ApiResource.create!(
:name => "MyString",
:description => "MyString",
:access_key => "MyString"
))
end
it "renders the edit api_resource form" do
render... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/views/api_resources/index.html.slim_spec.rb | Ruby | mit | 202 | master | 670 | require 'rails_helper'
RSpec.describe "api_resources/index", type: :view do
before(:each) do
assign(:api_resources, [
ApiResource.create!(
:name => "Name",
:description => "Description",
:access_key => "Access Key"
),
ApiResource.create!(
:name => "Name2",
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/views/api_resources/new.html.slim_spec.rb | Ruby | mit | 202 | master | 558 | require 'rails_helper'
RSpec.describe "api_resources/new", type: :view do
before(:each) do
assign(:api_resource, ApiResource.new(
:name => "MyString",
:description => "MyString",
:access_key => "MyString"
))
end
it "renders new api_resource form" do
render
assert_select "form[... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/views/api_resources/show.html.slim_spec.rb | Ruby | mit | 202 | master | 450 | require 'rails_helper'
RSpec.describe "api_resources/show", type: :view do
before(:each) do
@api_resource = assign(:api_resource, ApiResource.create!(
:name => "Name",
:description => "Description",
:access_key => "Access Key"
))
end
it "renders attributes in <p>" do
render
exp... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/views/layouts/home.html.slim_spec.rb | Ruby | mit | 202 | master | 1,079 | require 'rails_helper'
RSpec.describe 'layouts/home', type: :view do
before(:each) do
@cached_sign_in_type = ENV['SIGN_IN_TYPE']
end
after(:each) do
ENV['SIGN_IN_TYPE'] = @cached_sign_in_type
end
it 'should renders google auth link when use default sign in type' do
ENV['SIGN_IN_TYPE'] = ''
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/views/groups/show.html.slim_spec.rb | Ruby | mit | 202 | master | 563 | RSpec.describe 'groups/show', type: :view do
let(:admin) { create(:admin_user) }
let(:group) { create(:group) }
context 'authorized as admin' do
it 'should renders form to add user to group' do
sign_in admin
assign(:group, group)
assign(:group_users, [])
render
assert_sele... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/lib/datadog_spec.rb | Ruby | mit | 202 | master | 3,487 | require 'rails_helper'
RSpec.describe Datadog do
let(:org) { create(:organisation) }
let(:app_name) { 'datadog' }
describe 'initialize' do
it 'initialize datadog client if already saved' do
config = create(:saml_app_config, organisation: org)
expect(DataDogClient).to receive(:new).with(
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/lib/saml_app_spec.rb | Ruby | mit | 202 | master | 2,488 | require 'rails_helper'
RSpec.describe Datadog do
let(:org) { create(:organisation) }
let(:app_name) { 'datadog' }
let(:user) { create(:user) }
describe 'initialize' do
it 'fetches configuration if already saved' do
config = create(:saml_app_config, organisation: org)
saml_app = Datadog.new(or... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/lib/tasks/users_rake_spec.rb | Ruby | mit | 202 | master | 457 | require 'rails_helper'
describe "users:purge_inactive" do
before(:each) do
create(:user)
@user = create(:user)
@user.update!(active: false)
end
it "purge users whom have been deactivated for more than certain time" do
Gate::Application.load_tasks
@user.update_column(:deactivated_at, Time.now... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/group_endpoint_spec.rb | Ruby | mit | 202 | master | 874 | require 'rails_helper'
describe GroupEndpoint, type: :model do
let(:group) { create(:group) }
let(:endpoint) { create(:endpoint) }
describe 'validations' do
context 'given duplicate group with endpoint' do
it 'should not valid' do
GroupEndpoint.create(group: group, endpoint: endpoint)
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/access_token_spec.rb | Ruby | mit | 202 | master | 991 | require 'rails_helper'
RSpec.describe AccessToken, type: :model do
let(:user) {
FactoryBot.create(:user,
name: "foobar",
admin: true,
user_login_id: "foobar",
email: "foobar@foobar.com"
)
}
before(:each) do
@access_token = AccessToken.new
@access_token.token = ROTP::Base3... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/user_spec.rb | Ruby | mit | 202 | master | 25,050 | require 'rails_helper'
RSpec.describe User, type: :model do
let(:uid_constant) { 5000 }
describe 'generate_login_id' do
it 'should generate login id' do
user = build(:user)
expect(user.generate_login_id).to eq(user.email.split('@').first)
end
end
describe 'find_and_validate_saml_user' do
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/host_machine_spec.rb | Ruby | mit | 202 | master | 3,937 | require 'rails_helper'
RSpec.describe HostMachine, type: :model do
context "access" do
it "should compute overall groups and returns members in sysadmins group" do
host_machine = create(:host_machine)
group = create(:group)
user = create(:user)
group = create(:group)
group.host_m... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/group_association_spec.rb | Ruby | mit | 202 | master | 1,213 | require 'rails_helper'
describe GroupAssociation, type: :model do
describe '.revoke_expired' do
let(:user) { create(:user) }
let(:group) { create(:group) }
context 'when found expired associations' do
it 'should revoke associations' do
group.add_user_with_expiration(user, Date.today - 1)
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/group_spec.rb | Ruby | mit | 202 | master | 4,497 | require 'rails_helper'
GID_CONSTANT = 9000
RSpec.describe Group, type: :model do
context 'validate uniqueness' do
subject { FactoryBot.create(:group) }
it { should validate_uniqueness_of(:name).ignoring_case_sensitivity }
end
it 'should save gid after create' do
group = create(:group)
expect(grou... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/vpn_spec.rb | Ruby | mit | 202 | master | 1,735 | require 'rails_helper'
RSpec.describe Vpn, type: :model do
context "vpn administration" do
it "should test user and vpn management" do
vpn = Vpn.create(name: "X")
group = create(:group)
vpn.groups << group
vpn.save!
user = create(:user)
group.users << user
group.save!
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/api_resource_spec.rb | Ruby | mit | 202 | master | 1,593 | require 'rails_helper'
RSpec.describe ApiResource, type: :model do
let(:user) {
FactoryBot.create(:user,
name: "foobar",
admin: true,
user_login_id: "foobar",
email: "foobar@foobar.com"
)
}
let(:group) { FactoryBot.create(:group, name: "foobar_group") }
let(:valid_attributes) do... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/organisation_spec.rb | Ruby | mit | 202 | master | 2,843 | require 'rails_helper'
RSpec.describe Organisation, type: :model do
describe '.find_by_slug' do
let(:org) { create(:organisation) }
it 'should return organisation based on slug' do
expect(Organisation.find_by_slug(org.slug)).to eq(org)
end
end
describe '.setup' do
let(:org_data) { attribut... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/models/endpoint_spec.rb | Ruby | mit | 202 | master | 1,338 | require 'rails_helper'
describe Endpoint, type: :model do
describe 'validations' do
describe 'path' do
context 'when given nil path' do
it 'should not valid' do
endpoint = build(:endpoint, path: nil)
expect(endpoint).not_to be_valid
end
end
context 'when giv... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/users_controller_spec.rb | Ruby | mit | 202 | master | 8,039 | require 'rails_helper'
RSpec.describe UsersController, type: :controller do
let(:product_name) { "product-name" }
let!(:group) { FactoryBot.create(:group) }
let(:user) { FactoryBot.create(:user, name: "foobar", user_login_id: "foobar", email: "foobar@foobar.com") }
describe 'GET #show' do
context 'unau... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/vpns_controller_spec.rb | Ruby | mit | 202 | master | 2,589 | require 'rails_helper'
RSpec.describe VpnsController, type: :controller do
let(:user) { FactoryBot.create(:user, name: "foobar", admin: true, user_login_id: "foobar", email: "foobar@foobar.com") }
context "vpn operations" do
it "should return sorted vpns" do
#we should choose to stub the authenticatio... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/profile_controller_spec.rb | Ruby | mit | 202 | master | 1,897 | describe ProfileController, type: :controller do
let!(:admin) { create(:admin_user) }
let(:user) { create(:user, admin: false) }
describe '#update' do
context 'unauthenticated' do
it 'should return status 302' do
post :update, params: { id: user.id }
expect(response).to have_http_statu... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/groups_controller_spec.rb | Ruby | mit | 202 | master | 7,056 | require 'rails_helper'
RSpec.describe GroupsController, type: :controller do
let(:product_name) { 'product-name' }
let!(:admin) { create(:admin_user) }
let(:user) do
create(:user, name: 'foobar', user_login_id: 'foobar', email: 'foobar@foobar.com', admin: false)
end
describe 'GET #index' do
context... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/organisations_controller_spec.rb | Ruby | mit | 202 | master | 4,314 | require 'rails_helper'
describe OrganisationsController, type: :controller do
let(:valid_attributes) do
{
name: 'name',
website: 'sample.com',
domain: 'sample.com',
country: 'ID',
state: 'DKI Jakarta',
address: 'Jl Iskandarsyah II',
admin_email_address: 'admin@gate.com',... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/api_resources_controller_spec.rb | Ruby | mit | 202 | master | 10,877 | require 'rails_helper'
RSpec.describe ApiResourcesController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# ApiResource. As you add validations to ApiResource, be sure to
# adjust the attributes here as well.
let(:user) { FactoryBot.create(:user, name: "... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/host_machines_controller_spec.rb | Ruby | mit | 202 | master | 3,969 | require 'rails_helper'
RSpec.describe HostMachinesController, type: :controller do
let(:user) do
create(:user, name: 'foobar', user_login_id: 'foobar', email: 'foobar@foobar.com')
end
describe 'Search for Hosts' do
it 'should return hosts according to supplied search string' do
sign_in user
h... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/nss_controller_spec.rb | Ruby | mit | 202 | master | 6,461 | require 'rails_helper'
RSpec.describe NssController, type: :controller do
let(:access_token) { SecureRandom.uuid }
let(:email) { Faker::Internet.email }
let(:user) { FactoryBot.create(:user, name: "foobar", user_login_id: "foobar", email: "foobar@foobar.com") }
before(:each) do
group = create(:group)
e... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/api/v1/api_controller_spec.rb | Ruby | mit | 202 | master | 678 | require 'rails_helper'
RSpec.describe ::Api::V1::BaseController, type: :controller do
controller(::Api::V1::BaseController) do
def index
head :ok
end
end
describe 'Authentication' do
before(:each) do
@user = build(:user)
@user.access_token = build(:access_token)
@user.save
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/api/v1/vpns_controller_spec.rb | Ruby | mit | 202 | master | 1,947 | require 'rails_helper'
RSpec.describe ::Api::V1::VpnsController, type: :controller do
let(:valid_attributes) {
{name: 'jumbo'}
}
before(:each) do
@user = build(:user)
@user.access_token = build(:access_token)
@user.save
@token = @user.access_token.token
end
describe 'Authenticated' do
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/api/v1/users_controller_spec.rb | Ruby | mit | 202 | master | 8,447 | require 'rails_helper'
describe ::Api::V1::UsersController, type: :controller do
let(:valid_attributes) do
{ name: 'jumbo', email: 'jumbo.aux' }
end
before(:each) do
@admin = build(:user)
@admin.access_token = build(:access_token)
@admin.save
@admin_token = @admin.access_token.token
@us... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/api/v1/endpoints_controller_spec.rb | Ruby | mit | 202 | master | 5,169 | require 'rails_helper'
describe ::Api::V1::EndpointsController, type: :controller do
before(:each) do
@admin = build(:admin_user)
@admin.access_token = build(:access_token)
@admin.save!
@admin_token = @admin.access_token.token
end
let(:user) do
user = build(:user, admin: false)
user.acce... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/api/v1/groups_controller_spec.rb | Ruby | mit | 202 | master | 4,945 | require 'rails_helper'
RSpec.describe ::Api::V1::GroupsController, type: :controller do
let(:valid_attributes) do
{ name: 'jumbo' }
end
before(:each) do
@admin = build(:admin_user)
@admin.access_token = build(:access_token)
@admin.save
@admin_token = @admin.access_token.token
@user = bu... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/controllers/users/auth_controller_spec.rb | Ruby | mit | 202 | master | 1,616 | require 'rails_helper'
RSpec.describe Users::AuthController, type: :controller do
let(:user) { FactoryBot.create(:user, name: 'foobar', email: 'foobar@foobar.com') }
context 'sign in' do
before(:each) do
@cached_domain_env = ENV['GATE_HOSTED_DOMAINS']
@cached_sign_in_type = ENV['SIGN_IN_TYPE']
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/clients/data_dog_client_spec.rb | Ruby | mit | 202 | master | 3,098 | require 'rails_helper'
RSpec.describe DataDogClient do
let(:email) { Faker::Internet.email }
let(:org) { create(:organisation) }
let(:app_key) { Faker::Internet.password(min_length: 8) }
let(:api_key) { Faker::Internet.password(min_length: 8) }
let(:base_url) { 'https://api.datadoghq.com/api/v1' }
let(:cl... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/support/helpers/x509_certificate_helper.rb | Ruby | mit | 202 | master | 661 | class CertificateHelper
def initialize
@key = OpenSSL::PKey::RSA.new(1024)
@public_key = @key.public_key
subject = "/C=BE/O=Test/OU=Test/CN=Test"
@cert = OpenSSL::X509::Certificate.new
@cert.subject = @cert.issuer = OpenSSL::X509::Name.parse(subject)
@cert.not_before = Time.now
@cert.not... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/routing/api_resources_routing_spec.rb | Ruby | mit | 202 | master | 1,117 | require "rails_helper"
RSpec.describe ApiResourcesController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/api_resources").to route_to("api_resources#index")
end
it "routes to #new" do
expect(:get => "/api_resources/new").to route_to("api_resources#new")... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/helpers/application_helper_spec.rb | Ruby | mit | 202 | master | 807 | require 'rails_helper'
describe ApplicationHelper, type: :helper do
describe '.add_placeholder_to_list' do
let (:placeholder) { 'placeholder' }
let(:list) { (1..5).map { |ix| "row#{ix}" } }
it 'returns list with first element of every array titleized and adds placeholder' do
titleized_list = list.... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/factories/saml_app_configs.rb | Ruby | mit | 202 | master | 362 | FactoryBot.define do
factory :saml_app_config do
sso_url { Faker::Internet.url }
group { create(:group, name: "saml_#{Faker::Lorem.word}_datadog_users") }
config { { app_key: Faker::Internet.password(min_length: 8), api_key: Faker::Internet.password(min_length: 8) } }
organisation { build(:organisatio... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/factories/users.rb | Ruby | mit | 202 | master | 2,684 | FactoryBot.define do
factory :user do
transient do
user_roles_list { ENV['USER_ROLES'].split(',') }
hosted_domains_list { ENV['GATE_HOSTED_DOMAINS'].split(',') }
end
first_name { Faker::Name.first_name.gsub(/[^A-Za-z]/, '') }
last_name { Faker::Name.last_name.gsub(/[^A-Za-z]/, '') }
us... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | spec/factories/organisations.rb | Ruby | mit | 202 | master | 505 | FactoryBot.define do
#country = Country.find_country_by_name(Country.all.map(&:name).sort.sample)
factory :organisation do
sequence(:slug) { |n| "#{Faker::Lorem.word}_#{n}" }
name { Faker::Lorem.word }
website { Faker::Internet.url }
domain { Faker::Internet.email.split('@').last }
country { cou... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | lib/tasks/users.rake | Ruby | mit | 202 | master | 2,906 | namespace :users do
desc 'fill user_login_id with email domain prefix'
task migrate_user_login_id: :environment do
User.all.each do |user|
user.user_login_id = user.email.split('@').first
user.save!
puts "Migrating #{user.email}"
end
end
desc 'imports users and prints their keys'
ta... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | lib/tasks/vpn.rake | Ruby | mit | 202 | master | 873 | namespace :users do
desc "migrate vpn user from old group to new groups"
task migrate_vpns: :environment do
vpns = Vpn.all
vpns.each do |vpn|
admin_groups = vpn.groups
#create a new group for VPN
group = Group.create(name: "#{vpn.name}_access_group", description: "VPN Access group")
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | lib/tasks/setup.rake | Ruby | mit | 202 | master | 938 | namespace :setup do
desc "Setup open vpn config"
task :openvpn => [:key_dir, :certificate_authority] do
end
task :key_dir do
key_dir = Net::Openvpn::Generators::Keys::Directory.new
key_dir.generate
puts "#{key_dir} successfully generated" if key_dir.exist?
end
task :certificate_authority do
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | lib/tasks/app.rake | Ruby | mit | 202 | master | 385 | namespace :app do
desc "Common app related tasks"
task :init do
cp '.env.example', '.env'
p 'Please read information @ README.md - Setting up Environment Variables'
end
task :setup do
sh "bundle install"
sh "bundle exec rake db:drop db:create db:migrate"
sh "RAILS_ENV=test bundle exec rake... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | lib/vpn/mobileconfig.rb | Ruby | mit | 202 | master | 1,906 | require 'erb'
require 'vpn/namespace'
require 'openssl'
class Mobileconfig
def generate (vpns, user)
mobileconfig_template = File.read("#{Rails.root}/lib/vpn/mobileconfig.erb")
vpn_hash = []
vpns.each do |vpn|
vpn_hash << {
"payload_identifier" => "#{vpn.host_name.split('.').reverse.join('... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | api_blueprint/hooks/dredd_hooks.rb | Ruby | mit | 202 | master | 639 | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __dir__)
require 'dredd_hooks/methods'
include DreddHooks::Methods
before_all do |_|
user = User.create(name: 'foo', email: 'bar@test.com', admin: 1)
access_token = AccessToken.new
access_token.token = 'token'
access_token.user ... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/schedule.rb | Ruby | mit | 202 | master | 589 | # Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_m... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/routes.rb | Ruby | mit | 202 | master | 7,622 | Rails.application.routes.draw do
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }, :path_names => { :sign_in => 'login', :sign_out => 'logout' }
scope '/:slug/:app/saml' do
get '/auth' => 'saml_idp#new'
get '/metadata' => 'saml_idp#show'
post '/auth' => 'saml_idp... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/application.rb | Ruby | mit | 202 | master | 701 | 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 Gate
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails vers... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/initializers/dotenv.rb | Ruby | mit | 202 | master | 254 | begin
Dotenv.require_keys('GATE_DB_HOST',
'GATE_DB_PORT',
'GATE_DB_USER',
'GATE_DB_PASSWORD',
'CACHE_HOST',
'CACHE_PORT',
'GATE_HOSTED_DOMAINS',
'GATE_HOSTED_DOMAIN')
rescue => exception
puts exception.to_s
exit(-1)
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/initializers/new_framework_defaults.rb | Ruby | mit | 202 | master | 882 | # Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versi... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/initializers/devise.rb | Ruby | mit | 202 | master | 13,554 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/environments/test.rb | Ruby | mit | 202 | master | 2,445 | require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data the... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/environments/development.rb | Ruby | mit | 202 | master | 2,454 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for developme... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/environments/integration.rb | Ruby | mit | 202 | master | 3,342 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | config/environments/production.rb | Ruby | mit | 202 | master | 3,934 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/seeds.rb | Ruby | mit | 202 | master | 369 | # 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 rake db:seed (or created alongside the db with db:setup).
#
#
# this file loads seeds based on environments - so please be aware to run appropriate seed file
#
load(Rails.root.j... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/schema.rb | Ruby | mit | 202 | master | 11,745 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20171124115925_create_vpn_supplemental_match_domains.rb | Ruby | mit | 202 | master | 244 | class CreateVpnSupplementalMatchDomains < ActiveRecord::Migration[5.0]
def change
create_table :vpn_supplemental_match_domains do |t|
t.integer :vpn_id
t.string :supplemental_match_domain
t.timestamps
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20160419122430_devise_create_users.rb | Ruby | mit | 202 | master | 1,360 | class DeviseCreateUsers < ActiveRecord::Migration[5.0]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20171124114427_create_vpn_domain_name_servers.rb | Ruby | mit | 202 | master | 219 | class CreateVpnDomainNameServers < ActiveRecord::Migration[5.0]
def change
create_table :vpn_domain_name_servers do |t|
t.integer :vpn_id
t.string :server_address
t.timestamps
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20161003145832_create_host_access_groups.rb | Ruby | mit | 202 | master | 226 | class CreateHostAccessGroups < ActiveRecord::Migration[5.0]
def change
create_table :host_access_groups do |t|
t.references :host_machine
t.references :group
t.timestamps null: false
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20160615044834_create_hosts.rb | Ruby | mit | 202 | master | 208 | class CreateHosts < ActiveRecord::Migration[5.0]
def change
create_table :hosts do |t|
t.string :host_pattern
t.timestamps null: false
end
add_index :hosts, :host_pattern
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20171013115441_create_versions.rb | Ruby | mit | 202 | master | 1,689 | # This migration creates the `versions` table, the only schema PT requires.
# All other migrations PT provides are optional.
class CreateVersions < ActiveRecord::Migration[5.0]
# The largest text column available in all supported RDBMS is
# 1024^3 - 1 bytes, roughly one gibibyte. We specify a size
# so that MyS... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20171124114830_create_vpn_search_domains.rb | Ruby | mit | 202 | master | 209 | class CreateVpnSearchDomains < ActiveRecord::Migration[5.0]
def change
create_table :vpn_search_domains do |t|
t.integer :vpn_id
t.string :search_domain
t.timestamps
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20160629075435_create_groups.rb | Ruby | mit | 202 | master | 216 | class CreateGroups < ActiveRecord::Migration[5.0]
def change
create_table :groups do |t|
t.string :name
t.integer :gid
t.timestamps null: false
end
add_index :groups, :name
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20180318083000_create_indexes_to_speedup_nss_controller.rb | Ruby | mit | 202 | master | 359 | class CreateIndexesToSpeedupNssController < ActiveRecord::Migration[5.0]
def change
add_index :users, :uid
add_index :access_tokens, :hashed_token
add_index :host_machines, :access_key
add_index :host_access_groups, [:host_machine_id, :group_id]
add_index :group_associations, [:group_id, :user_id]... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20180227051732_create_api_resources.rb | Ruby | mit | 202 | master | 234 | class CreateApiResources < ActiveRecord::Migration[5.0]
def change
create_table :api_resources do |t|
t.string :name
t.string :description
t.string :access_key
t.timestamps null: false
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20180613074108_create_organisations.rb | Ruby | mit | 202 | master | 229 | class CreateOrganisations < ActiveRecord::Migration[5.0]
def change
create_table :organisations do |t|
t.string :name
t.string :url
t.string :email_domain
t.timestamps null: false
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20181208184236_add_fields_to_user.rb | Ruby | mit | 202 | master | 295 | class AddFieldsToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :first_name, :string
add_column :users, :last_name, :string
add_column :users, :user_role, :string
add_column :users, :mobile, :string
add_column :users, :alternate_email, :string
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20180723175600_update_organisations_for_saml.rb | Ruby | mit | 202 | master | 658 | class UpdateOrganisationsForSaml < ActiveRecord::Migration[5.0]
def change
rename_column :organisations, :url, :website
rename_column :organisations, :email_domain, :domain
add_column :organisations, :country, :string
add_column :organisations, :state, :string
add_column :organisations, :address, ... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20180202102206_create_saml_service_providers.rb | Ruby | mit | 202 | master | 330 | class CreateSamlServiceProviders < ActiveRecord::Migration[5.0]
def change
create_table :saml_service_providers do |t|
t.string :name, null: false, unique: true
t.string :sso_url, null: false, unique: true
t.string :metadata_url, null: false, unique: true
t.timestamps null: false
end
... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20181016093315_create_saml_app_configs.rb | Ruby | mit | 202 | master | 318 | class CreateSamlAppConfigs < ActiveRecord::Migration[5.0]
def change
create_table :saml_app_configs do |t|
t.references :group, foreign_key: true
t.string :sso_url
t.json :config
t.references :organisation, foreign_key: true
t.string :app_name
t.timestamps
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20190820075040_create_group_endpoints.rb | Ruby | mit | 202 | master | 216 | class CreateGroupEndpoints < ActiveRecord::Migration[5.1]
def change
create_table :group_endpoints do |t|
t.integer :group_id
t.bigint :endpoint_id
t.timestamps null: false
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20171031121702_add_foreign_key_ref_on_vpn_group_user_association.rb | Ruby | mit | 202 | master | 273 | class AddForeignKeyRefOnVpnGroupUserAssociation < ActiveRecord::Migration[5.0]
def change
add_foreign_key :vpn_group_user_associations, :users
add_foreign_key :vpn_group_user_associations, :groups
add_foreign_key :vpn_group_user_associations, :vpns
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20171031113123_create_vpn_group_user_association.rb | Ruby | mit | 202 | master | 246 | class CreateVpnGroupUserAssociation < ActiveRecord::Migration[5.0]
def change
create_table :vpn_group_user_associations do |t|
t.integer :user_id
t.integer :vpn_id
t.integer :group_id
t.timestamps
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20190820070910_create_endpoints.rb | Ruby | mit | 202 | master | 221 | class CreateEndpoints < ActiveRecord::Migration[5.1]
def change
create_table :endpoints do |t|
t.string :path, null: false
t.string :method, null: false
t.timestamps null: false
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20200113065717_add_sessions_table.rb | Ruby | mit | 202 | master | 292 | class AddSessionsTable < ActiveRecord::Migration[5.1]
def change
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :sessions, :session_id, :unique => true
add_index :sessions, :updated_at
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20171031103518_add_foreign_key_ref_on_vpn_group_association.rb | Ruby | mit | 202 | master | 202 | class AddForeignKeyRefOnVpnGroupAssociation < ActiveRecord::Migration[5.0]
def change
add_foreign_key :vpn_group_associations, :groups
add_foreign_key :vpn_group_associations, :vpns
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20171031101026_create_vpn_group_association.rb | Ruby | mit | 202 | master | 212 | class CreateVpnGroupAssociation < ActiveRecord::Migration[5.0]
def change
create_table :vpn_group_associations do |t|
t.integer :group_id
t.integer :vpn_id
t.timestamps
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20160701090045_create_group_associations.rb | Ruby | mit | 202 | master | 219 | class CreateGroupAssociations < ActiveRecord::Migration[5.0]
def change
create_table :group_associations do |t|
t.references :user
t.references :group
t.timestamps null: false
end
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/migrate/20180214052451_create_ip_addresses.rb | Ruby | mit | 202 | master | 288 | class CreateIpAddresses < ActiveRecord::Migration[5.0]
def change
create_table :ip_addresses do |t|
t.string :address
t.string :mac_address
t.timestamps null: false
end
add_index :ip_addresses, :address
add_index :ip_addresses, :mac_address
end
end |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/seeds/production.rb | Ruby | mit | 202 | master | 536 | # 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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/seeds/development.rb | Ruby | mit | 202 | master | 882 | dev_user = User.create_user('dev', 'dev@a.c')
dev_user.generate_two_factor_auth
(1..6).each do |uid|
user = User.create_user("dev#{uid}", "dev#{uid}@a.c")
user.generate_two_factor_auth
end
group = Group.create(name: 'people')
User.all.each do |user|
user.groups << group
user.save!
end
AccessToken.create(token: ... |
github | gate-sso/gate-openvpn | https://github.com/gate-sso/gate-openvpn | db/seeds/test.rb | Ruby | mit | 202 | master | 345 | # 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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
github | eviltrout/agi-upscale | https://github.com/eviltrout/agi-upscale | pic_data.rb | Ruby | mit | 202 | main | 951 | # frozen_string_literal: true
class PicData
attr_reader :cmds, :ip
attr_accessor :compressed
def initialize(cmds)
@cmds = cmds.unpack('C*')
@compressed = false
@ip = 0
@on_nibble = false
end
def compressed?
@compressed
end
def next_nibble
if @on_nibble
@on_nibble = false... |
github | eviltrout/agi-upscale | https://github.com/eviltrout/agi-upscale | constants.rb | Ruby | mit | 202 | main | 1,426 | # frozen_string_literal: true
X_SIZE = 160
Y_SIZE = 168
CMDS = {
pic_color: 0xf0,
disable_pic: 0xf1,
pri_color: 0xf2,
disable_pri: 0xf3,
y_corner: 0xf4,
x_corner: 0xf5,
abs_line: 0xf6,
rel_line: 0xf7,
fill: 0xf8,
brush_style: 0xf9,
brush_draw: 0xfa,
end: 0xff
}
COLORS = {
0 => "#000000",
... |
github | eviltrout/agi-upscale | https://github.com/eviltrout/agi-upscale | pic_buffer.rb | Ruby | mit | 202 | main | 651 | # frozen_string_literal: true
class PicBuffer
attr_accessor :width, :height
def initialize(width, height, default = 0)
@width, @height = width, height
@data = []
@height.times { @data << Array.new(@width, default) }
end
def []=(x, y, color)
return if x < 0 || y < 0 || x > @width - 1 || y > @... |
github | eviltrout/agi-upscale | https://github.com/eviltrout/agi-upscale | pic.rb | Ruby | mit | 202 | main | 958 | # frozen_string_literal: true
require 'rubygems'
require 'bundler'
Bundler.require(:default)
require './constants'
require './helpers'
require './pic_buffer'
require './pic_data'
require './pic_path'
require './pic_loader'
require './pic_renderer'
if ARGV.size != 3
puts "Usage: #{$0} <game directory> <pic id> <ou... |
github | eviltrout/agi-upscale | https://github.com/eviltrout/agi-upscale | pic_path.rb | Ruby | mit | 202 | main | 209 | # frozen_string_literal: true
class PicPath
attr_reader :points, :color
def initialize(color, x, y)
@color = color
@points = [[x, y]]
end
def add_point(x, y)
@points << [x, y]
end
end |
github | eviltrout/agi-upscale | https://github.com/eviltrout/agi-upscale | pic_loader.rb | Ruby | mit | 202 | main | 1,878 | # frozen_string_literal: true
class PicLoader
attr_accessor :entries, :db
def initialize(dir)
@dir = dir
@db = {}
@prefix = ''
@version = 2
end
def setup
dir_file = "#{@dir}/PICDIR"
if File.exist?(dir_file)
@version = 2
File.open(dir_file, 'rb') { |f| load_entries(f) }
... |
github | eviltrout/agi-upscale | https://github.com/eviltrout/agi-upscale | pic_renderer.rb | Ruby | mit | 202 | main | 10,653 | # frozen_string_literal: true
require 'set'
class PicRenderer
def initialize(data)
@pic_target = PicBuffer.new(X_SIZE, Y_SIZE, 15)
@pri_target = PicBuffer.new(X_SIZE, Y_SIZE, 4)
@paths = []
@dots = []
@draw_pic = true
@draw_pri = false
@brush = 0x10
@texture = 0
@current_path ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.