Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fb664948
Commit
fb664948
authored
Mar 01, 2019
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add model and migration
parent
a949f94f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
0 deletions
+63
-0
db/migrate/20190301095211_create_scim_oauth_access_tokens.rb
db/migrate/20190301095211_create_scim_oauth_access_tokens.rb
+12
-0
ee/app/controllers/groups/scim_oauth_controller.rb
ee/app/controllers/groups/scim_oauth_controller.rb
+20
-0
ee/app/models/scim_oauth_access_token.rb
ee/app/models/scim_oauth_access_token.rb
+12
-0
ee/spec/models/scim_oauth_access_token_spec.rb
ee/spec/models/scim_oauth_access_token_spec.rb
+19
-0
No files found.
db/migrate/20190301095211_create_scim_oauth_access_tokens.rb
0 → 100644
View file @
fb664948
class
CreateScimOauthAccessTokens
<
ActiveRecord
::
Migration
[
5.0
]
def
change
create_table
:scim_oauth_access_tokens
do
|
t
|
t
.
timestamps_with_timezone
null:
false
t
.
references
:group
,
null:
false
,
index:
false
t
.
string
"token"
,
null:
false
t
.
index
[
:group_id
,
:token
],
unique:
true
t
.
foreign_key
:namespaces
,
column: :group_id
,
on_delete: :cascade
end
end
end
ee/app/controllers/groups/scim_oauth_controller.rb
0 → 100644
View file @
fb664948
# frozen_string_literal: true
class
Groups::ScimOauthController
<
Groups
::
ApplicationController
before_action
:require_top_level_group
before_action
:authorize_manage_saml!
before_action
:check_group_saml_available!
before_action
:check_group_saml_configured
def
show
@saml_provider
=
@group
.
saml_provider
||
@group
.
build_saml_provider
end
def
create
@saml_provider
=
@group
.
build_saml_provider
(
saml_provider_params
)
@saml_provider
.
save
render
:show
end
end
ee/app/models/scim_oauth_access_token.rb
0 → 100644
View file @
fb664948
# frozen_string_literal: true
class
ScimOauthAccessToken
<
ActiveRecord
::
Base
include
TokenAuthenticatable
belongs_to
:group
add_authentication_token_field
:token
validates
:group
,
presence:
true
before_save
:ensure_token
end
ee/spec/models/scim_oauth_access_token_spec.rb
0 → 100644
View file @
fb664948
require
'spec_helper'
describe
ScimOauthAccessToken
do
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
:group
}
end
describe
'Validations'
do
it
{
is_expected
.
to
validate_presence_of
(
:group
)
}
end
describe
'#token'
do
it
'generates a token on creation'
do
scim_token
=
described_class
.
create
(
group:
create
(
:group
))
expect
(
scim_token
.
token
).
to
be_a
(
String
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment