Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
keycloak-scim
Manage
Activity
Members
Labels
Plan
Issues
13
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
libre.sh
scim
keycloak-scim
Commits
54a2f101
Commit
54a2f101
authored
1 year ago
by
Brendan Le Ny
Committed by
Alex Morel
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Factorize URI creations
parent
ad60363c
No related branches found
No related tags found
1 merge request
!3
Sonar refactoring
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/sh/libre/scim/core/AbstractScimService.java
+8
-4
8 additions, 4 deletions
src/main/java/sh/libre/scim/core/AbstractScimService.java
src/main/java/sh/libre/scim/core/GroupScimService.java
+2
-8
2 additions, 8 deletions
src/main/java/sh/libre/scim/core/GroupScimService.java
with
10 additions
and
12 deletions
src/main/java/sh/libre/scim/core/AbstractScimService.java
+
8
−
4
View file @
54a2f101
...
@@ -207,13 +207,17 @@ public abstract class AbstractScimService<RMM extends RoleMapperModel, S extends
...
@@ -207,13 +207,17 @@ public abstract class AbstractScimService<RMM extends RoleMapperModel, S extends
protected
Meta
newMetaLocation
(
EntityOnRemoteScimId
externalId
)
{
protected
Meta
newMetaLocation
(
EntityOnRemoteScimId
externalId
)
{
Meta
meta
=
new
Meta
();
Meta
meta
=
new
Meta
();
URI
uri
=
getUri
(
type
,
externalId
);
meta
.
setLocation
(
uri
.
toString
());
return
meta
;
}
protected
URI
getUri
(
ScimResourceType
type
,
EntityOnRemoteScimId
externalId
)
{
try
{
try
{
URI
uri
=
new
URI
(
"%ss/%s"
.
formatted
(
type
,
externalId
.
asString
()));
return
new
URI
(
"%s/%s"
.
formatted
(
type
.
getEndpoint
(),
externalId
.
asString
()));
meta
.
setLocation
(
uri
.
toString
());
}
catch
(
URISyntaxException
e
)
{
}
catch
(
URISyntaxException
e
)
{
LOGGER
.
warn
(
e
);
throw
new
IllegalStateException
(
"should never occur: can not format URI for type %s and id %s"
.
formatted
(
type
,
externalId
)
,
e
);
}
}
return
meta
;
}
}
protected
KeycloakDao
getKeycloakDao
()
{
protected
KeycloakDao
getKeycloakDao
()
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/sh/libre/scim/core/GroupScimService.java
+
2
−
8
View file @
54a2f101
...
@@ -13,7 +13,6 @@ import org.keycloak.models.UserModel;
...
@@ -13,7 +13,6 @@ import org.keycloak.models.UserModel;
import
sh.libre.scim.jpa.ScimResource
;
import
sh.libre.scim.jpa.ScimResource
;
import
java.net.URI
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -94,13 +93,8 @@ public class GroupScimService extends AbstractScimService<GroupModel, Group> {
...
@@ -94,13 +93,8 @@ public class GroupScimService extends AbstractScimService<GroupModel, Group> {
EntityOnRemoteScimId
externalIdAsEntityOnRemoteScimId
=
groupMemberMapping
.
getExternalIdAsEntityOnRemoteScimId
();
EntityOnRemoteScimId
externalIdAsEntityOnRemoteScimId
=
groupMemberMapping
.
getExternalIdAsEntityOnRemoteScimId
();
logger
.
debugf
(
"found mapping for group member %s as %s"
,
member
,
externalIdAsEntityOnRemoteScimId
);
logger
.
debugf
(
"found mapping for group member %s as %s"
,
member
,
externalIdAsEntityOnRemoteScimId
);
groupMember
.
setValue
(
externalIdAsEntityOnRemoteScimId
.
asString
());
groupMember
.
setValue
(
externalIdAsEntityOnRemoteScimId
.
asString
());
try
{
URI
ref
=
getUri
(
ScimResourceType
.
USER
,
externalIdAsEntityOnRemoteScimId
);
String
refString
=
String
.
format
(
"Users/%s"
,
externalIdAsEntityOnRemoteScimId
.
asString
());
groupMember
.
setRef
(
ref
.
toString
());
URI
ref
=
new
URI
(
refString
);
groupMember
.
setRef
(
ref
.
toString
());
}
catch
(
URISyntaxException
e
)
{
logger
.
warnf
(
"bad ref uri for member "
+
member
);
}
group
.
addMember
(
groupMember
);
group
.
addMember
(
groupMember
);
}
else
{
}
else
{
logger
.
warnf
(
"member %s not found for group %s"
,
member
,
groupModel
.
getId
());
logger
.
warnf
(
"member %s not found for group %s"
,
member
,
groupModel
.
getId
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment