Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
STS
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coscine
backend
apis
STS
Merge requests
!101
Issue/40 rds quota for uka
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue/40 rds quota for uka
Issue/40-rdsQuotaForUKA
into
Sprint/2021-20
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
Petar Hristov
requested to merge
Issue/40-rdsQuotaForUKA
into
Sprint/2021-20
3 years ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
rpdm/issues#40
Edited
3 years ago
by
Petar Hristov
0
0
Merge request reports
Compare
Sprint/2021-20
Sprint/2021-20 (base)
and
latest version
latest version
094ea9b5
1 commit,
3 years ago
1 file
+
13
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/STS/Controllers/ShibbolethController.cs
+
13
−
9
Options
@@ -54,8 +54,8 @@ namespace Coscine.Api.STS.Controllers
var
entityId
=
entity
[(
entity
.
IndexOf
(
"NameQualifier=\""
)
+
"NameQualifier=\""
.
Length
)..];
entityId
=
entityId
.
Substring
(
0
,
entityId
.
IndexOf
(
"\""
));
var
mapping
=
externalIdModel
.
GetAllWhere
((
map
)
=>
map
.
ExternalId1
==
identifier
var
mapping
=
externalIdModel
.
GetAllWhere
((
map
)
=>
map
.
ExternalId1
==
identifier
&&
map
.
ExternalAuthenticatorId
==
shibbolethAuthItem
.
Id
&&
map
.
Organization
==
entityId
);
@@ -88,20 +88,24 @@ namespace Coscine.Api.STS.Controllers
var
organization
=
_rdfStoreConnector
.
GetOrganization
(
entityId
,
identifier
);
// Can only update data if an org was found.
if
(
organization
!=
null
)
if
(
organization
!=
null
)
{
// Drop old membership infromation.
_rdfStoreConnector
.
RemoveMembershipData
(
userGraphName
,
organization
);
// Reverse lookup...
var
eduPersonScopedAffiliation
=
info
.
Principal
.
FindAll
(
ShibbolethAttributeMapping
.
LabelMapping
.
FirstOrDefault
(
x
=>
x
.
Value
==
"Entitlement"
).
Key
);
if
(
eduPersonScopedAffiliation
.
Any
(
x
=>
x
.
Value
.
StartsWith
(
"employee@"
))
// Check for test shib (employee user is actually member...).
||
(
eduPersonScopedAffiliation
.
Any
(
x
=>
x
.
Value
.
StartsWith
(
"member@"
)
&&
entityId
==
"https://login-test.rz.rwth-aachen.de/shibboleth"
)))
var
orgFromId
=
_rdfStoreConnector
.
GetOrgnizationWithIdentifier
(
identifier
);
if
(
eduPersonScopedAffiliation
.
Any
(
x
=>
x
.
Value
.
StartsWith
(
"employee@"
)))
{
// Add membership information.
_rdfStoreConnector
.
AddMemebershipData
(
userGraphName
,
organization
);
}
else
if
(
orgFromId
!=
null
)
{
// Add membership information.
_rdfStoreConnector
.
AddMemebershipData
(
userGraphName
,
orgFromId
);
}
}
var
coscineUser
=
new
CoscineUser
()
@@ -109,12 +113,12 @@ namespace Coscine.Api.STS.Controllers
UserName
=
user
.
Id
.
ToString
(),
Email
=
user
.
EmailAddress
??
""
};
var
result
=
await
_signInManager
.
UserManager
.
CreateAsync
(
coscineUser
);
result
=
await
_signInManager
.
UserManager
.
AddLoginAsync
(
coscineUser
,
info
);
await
_signInManager
.
SignInAsync
(
coscineUser
,
isPersistent
:
false
);
await
_signInManager
.
SignInAsync
(
coscineUser
,
isPersistent
:
false
);
return
Redirect
(
UrlGenerator
.
ExtendReturnUrl
(
returnUrl
,
Request
));
return
Redirect
(
UrlGenerator
.
ExtendReturnUrl
(
returnUrl
,
Request
));
}
/// <summary>
Loading