-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
'origin/issue/175_Template_Engine_for_HTML_UIs' into develop
- Loading branch information
Showing
214 changed files
with
34,423 additions
and
4,365 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
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 |
---|---|---|
|
@@ -3,4 +3,5 @@ Dockerfile | |
lib/README.md | ||
lib_external/README.md | ||
log/README.md | ||
process/README.md | ||
process/README.md | ||
ui/README.md |
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
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 @@ | ||
empty ui directory for static override resources |
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
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
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
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
9 changes: 8 additions & 1 deletion
9
dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/authentication/BpeServerRole.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,8 +1,15 @@ | ||
package dev.dsf.bpe.authentication; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import dev.dsf.common.auth.conf.DsfRole; | ||
|
||
public enum BpeServerRole implements DsfRole | ||
{ | ||
ORGANIZATION | ||
ADMIN; | ||
|
||
public static boolean isValid(String role) | ||
{ | ||
return role != null && !role.isBlank() && Stream.of(values()).map(Enum::name).anyMatch(n -> n.equals(role)); | ||
} | ||
} |
167 changes: 45 additions & 122 deletions
167
dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/authentication/IdentityProviderImpl.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,150 +1,73 @@ | ||
package dev.dsf.bpe.authentication; | ||
|
||
import java.security.cert.X509Certificate; | ||
import java.util.Collections; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
import javax.security.auth.x500.X500Principal; | ||
|
||
import org.hl7.fhir.r4.model.Coding; | ||
import org.hl7.fhir.r4.model.Organization; | ||
import org.hl7.fhir.r4.model.Practitioner; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.InitializingBean; | ||
|
||
import dev.dsf.common.auth.DsfOpenIdCredentials; | ||
import dev.dsf.common.auth.conf.DsfRole; | ||
import dev.dsf.bpe.service.LocalOrganizationProvider; | ||
import dev.dsf.common.auth.conf.AbstractIdentityProvider; | ||
import dev.dsf.common.auth.conf.Identity; | ||
import dev.dsf.common.auth.conf.IdentityProvider; | ||
import dev.dsf.common.auth.conf.OrganizationIdentity; | ||
import dev.dsf.common.auth.conf.PractitionerIdentity; | ||
import dev.dsf.common.auth.conf.PractitionerIdentityImpl; | ||
import dev.dsf.common.auth.conf.RoleConfig; | ||
|
||
public class IdentityProviderImpl implements IdentityProvider | ||
public class IdentityProviderImpl extends AbstractIdentityProvider implements IdentityProvider, InitializingBean | ||
{ | ||
@Override | ||
public Identity getIdentity(DsfOpenIdCredentials credentials) | ||
{ | ||
return new PractitionerIdentity() | ||
{ | ||
@Override | ||
public String getName() | ||
{ | ||
return credentials.getUserId(); | ||
} | ||
|
||
@Override | ||
public String getDisplayName() | ||
{ | ||
return getName(); | ||
} | ||
|
||
@Override | ||
public boolean isLocalIdentity() | ||
{ | ||
return true; | ||
} | ||
private static final Logger logger = LoggerFactory.getLogger(IdentityProviderImpl.class); | ||
|
||
@Override | ||
public boolean hasDsfRole(DsfRole role) | ||
{ | ||
return BpeServerRole.ORGANIZATION.equals(role); | ||
} | ||
private final LocalOrganizationProvider organizationProvider; | ||
|
||
@Override | ||
public Set<DsfRole> getDsfRoles() | ||
{ | ||
return Collections.singleton(BpeServerRole.ORGANIZATION); | ||
} | ||
|
||
@Override | ||
public Optional<String> getOrganizationIdentifierValue() | ||
{ | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Organization getOrganization() | ||
{ | ||
return null; | ||
} | ||
public IdentityProviderImpl(RoleConfig roleConfig, LocalOrganizationProvider organizationProvider) | ||
{ | ||
super(roleConfig); | ||
|
||
@Override | ||
public Practitioner getPractitioner() | ||
{ | ||
return null; | ||
} | ||
this.organizationProvider = organizationProvider; | ||
} | ||
|
||
@Override | ||
public Set<Coding> getPractionerRoles() | ||
{ | ||
return Collections.emptySet(); | ||
} | ||
@Override | ||
public void afterPropertiesSet() throws Exception | ||
{ | ||
super.afterPropertiesSet(); | ||
|
||
@Override | ||
public Optional<DsfOpenIdCredentials> getCredentials() | ||
{ | ||
return Optional.of(credentials); | ||
} | ||
Objects.requireNonNull(organizationProvider, "organizationProvider"); | ||
} | ||
|
||
@Override | ||
public Optional<X509Certificate> getCertificate() | ||
{ | ||
return Optional.empty(); | ||
} | ||
}; | ||
@Override | ||
protected Optional<Organization> getLocalOrganization() | ||
{ | ||
return organizationProvider.getLocalOrganization(); | ||
} | ||
|
||
@Override | ||
public Identity getIdentity(X509Certificate[] certificates) | ||
{ | ||
return new OrganizationIdentity() | ||
{ | ||
@Override | ||
public String getName() | ||
{ | ||
return certificates[0].getSubjectX500Principal().getName(X500Principal.RFC1779); | ||
} | ||
|
||
@Override | ||
public String getDisplayName() | ||
{ | ||
return getName(); | ||
} | ||
if (certificates == null || certificates.length == 0) | ||
return null; | ||
|
||
@Override | ||
public Set<DsfRole> getDsfRoles() | ||
{ | ||
return Collections.singleton(BpeServerRole.ORGANIZATION); | ||
} | ||
String thumbprint = getThumbprint(certificates[0]); | ||
|
||
@Override | ||
public Organization getOrganization() | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isLocalIdentity() | ||
{ | ||
return true; | ||
} | ||
|
||
@Override | ||
public Optional<String> getOrganizationIdentifierValue() | ||
{ | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public boolean hasDsfRole(DsfRole role) | ||
{ | ||
return BpeServerRole.ORGANIZATION.equals(role); | ||
} | ||
Optional<Practitioner> practitioner = toPractitioner(certificates[0]); | ||
Optional<Organization> localOrganization = organizationProvider.getLocalOrganization(); | ||
if (practitioner.isPresent() && localOrganization.isPresent()) | ||
{ | ||
Practitioner p = practitioner.get(); | ||
Organization o = localOrganization.get(); | ||
|
||
@Override | ||
public Optional<X509Certificate> getCertificate() | ||
{ | ||
return Optional.of(certificates[0]); | ||
} | ||
}; | ||
return new PractitionerIdentityImpl(o, getDsfRolesFor(p, thumbprint, null, null), certificates[0], p, | ||
getPractitionerRolesFor(p, thumbprint, null, null), null); | ||
} | ||
else | ||
{ | ||
logger.warn( | ||
"Certificate with thumbprint '{}' for '{}' unknown, not configured as local user or local organization unknown", | ||
thumbprint, getDn(certificates[0])); | ||
return null; | ||
} | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationProvider.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,10 @@ | ||
package dev.dsf.bpe.service; | ||
|
||
import java.util.Optional; | ||
|
||
import org.hl7.fhir.r4.model.Organization; | ||
|
||
public interface LocalOrganizationProvider | ||
{ | ||
Optional<Organization> getLocalOrganization(); | ||
} |
Oops, something went wrong.