-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* provisioning/patch: Removed JaCoCo maven plugin Added JaCoCo maven plugin Fixed missing user delete Fixing tests Fixed unique constraint on iam_ssh_key and improved patch-replace tests Bunch if fixes and added V6 db update Fixed gitignore Added x509 provisioning tests Fixed patch-replace for x509 certificates and ssh key display and primary Cosmetic fix Cleared empty indigouser json field fixed patch add request with duplicated id Added PATCH add/remove samlId Cosmetic fixes Added tests on ssh key patch and few adjustments ssh key patch remove fixed to allow only display or fingerprint Added sshkey scim add/remove support
- Loading branch information
Showing
48 changed files
with
2,668 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/target/ | ||
.factorypath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 9 additions & 28 deletions
37
iam-login-service/src/main/java/it/infn/mw/iam/api/scim/converter/OidcIdConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,31 @@ | ||
package it.infn.mw.iam.api.scim.converter; | ||
|
||
import java.util.Optional; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import it.infn.mw.iam.api.scim.model.ScimOidcId; | ||
import it.infn.mw.iam.persistence.model.IamOidcId; | ||
import it.infn.mw.iam.persistence.repository.IamOidcIdRepository; | ||
|
||
@Service | ||
public class OidcIdConverter implements Converter<ScimOidcId, IamOidcId> { | ||
|
||
private final IamOidcIdRepository oidcIdRepository; | ||
|
||
@Autowired | ||
public OidcIdConverter(IamOidcIdRepository oidcIdRepository) { | ||
|
||
this.oidcIdRepository = oidcIdRepository; | ||
} | ||
|
||
@Override | ||
public IamOidcId fromScim(ScimOidcId scim) { | ||
|
||
/* Try loading from persistence the OpenID Connect id */ | ||
Optional<IamOidcId> oidcId = oidcIdRepository.findByIssuerAndSubject(scim.issuer, scim.subject); | ||
|
||
if (oidcId.isPresent()) { | ||
return oidcId.get(); | ||
} | ||
IamOidcId oidcId = new IamOidcId(); | ||
oidcId.setIssuer(scim.getIssuer()); | ||
oidcId.setSubject(scim.getSubject()); | ||
oidcId.setAccount(null); | ||
|
||
/* It's a new OpenID Connect id */ | ||
IamOidcId oidcIdNew = new IamOidcId(); | ||
oidcIdNew.setIssuer(scim.issuer); | ||
oidcIdNew.setSubject(scim.subject); | ||
oidcIdNew.setAccount(null); | ||
return oidcIdNew; | ||
return oidcId; | ||
} | ||
|
||
@Override | ||
public ScimOidcId toScim(IamOidcId entity) { | ||
|
||
ScimOidcId.Builder builder = | ||
ScimOidcId.builder().issuer(entity.getIssuer()).subject(entity.getSubject()); | ||
ScimOidcId.Builder builder = ScimOidcId.builder() | ||
.issuer(entity.getIssuer()) | ||
.subject(entity.getSubject()); | ||
|
||
return builder.build(); | ||
} | ||
|
||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
iam-login-service/src/main/java/it/infn/mw/iam/api/scim/converter/SamlIdConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package it.infn.mw.iam.api.scim.converter; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import it.infn.mw.iam.api.scim.model.ScimSamlId; | ||
import it.infn.mw.iam.persistence.model.IamSamlId; | ||
|
||
@Service | ||
public class SamlIdConverter implements Converter<ScimSamlId, IamSamlId> { | ||
|
||
@Override | ||
public IamSamlId fromScim(ScimSamlId scim) { | ||
|
||
IamSamlId samlId = new IamSamlId(); | ||
samlId.setIdpId(scim.getIdpId()); | ||
samlId.setUserId(scim.getUserId()); | ||
samlId.setAccount(null); | ||
|
||
return samlId; | ||
} | ||
|
||
@Override | ||
public ScimSamlId toScim(IamSamlId entity) { | ||
|
||
return ScimSamlId.builder().idpId(entity.getIdpId()).userId(entity.getUserId()).build(); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
iam-login-service/src/main/java/it/infn/mw/iam/api/scim/converter/SshKeyConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package it.infn.mw.iam.api.scim.converter; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import it.infn.mw.iam.api.scim.model.ScimSshKey; | ||
import it.infn.mw.iam.persistence.model.IamSshKey; | ||
|
||
@Service | ||
public class SshKeyConverter implements Converter<ScimSshKey, IamSshKey> { | ||
|
||
@Override | ||
public IamSshKey fromScim(ScimSshKey scim) { | ||
|
||
IamSshKey sshKey = new IamSshKey(); | ||
sshKey.setLabel(scim.getDisplay()); | ||
sshKey.setFingerprint(scim.getFingerprint()); | ||
sshKey.setValue(scim.getValue()); | ||
|
||
if (scim.isPrimary() != null) { | ||
sshKey.setPrimary(scim.isPrimary()); | ||
} else { | ||
sshKey.setPrimary(false); | ||
} | ||
|
||
sshKey.setAccount(null); | ||
|
||
return sshKey; | ||
} | ||
|
||
@Override | ||
public ScimSshKey toScim(IamSshKey entity) { | ||
|
||
ScimSshKey.Builder builder = ScimSshKey.builder() | ||
.display(entity.getLabel()) | ||
.primary(entity.isPrimary()) | ||
.value(entity.getValue()) | ||
.fingerprint(entity.getFingerprint()); | ||
|
||
return builder.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.