use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.MemberType in project X-Road by nordic-institute.
the class SharedParametersV2 method cacheSecurityServers.
private void cacheSecurityServers() {
// Map of XML ID fields mapped to client IDs
Map<String, ClientId> clientIds = getClientIds();
for (SecurityServerType securityServer : confType.getSecurityServer()) {
// Cache the server.
for (byte[] certHash : securityServer.getAuthCertHash()) {
serverByAuthCert.put(encodeBase64(certHash), securityServer);
}
// Add owner of the security server.
MemberType owner = (MemberType) securityServer.getOwner();
addServerClient(createMemberId(owner), securityServer);
// cache security server information by serverId
SecurityServerId securityServerId = SecurityServerId.create(confType.getInstanceIdentifier(), owner.getMemberClass().getCode(), owner.getMemberCode(), securityServer.getServerCode());
securityServersById.put(securityServerId, securityServer);
// Add clients of the security server.
for (JAXBElement<?> client : securityServer.getClient()) {
Object val = client.getValue();
if (val instanceof MemberType) {
addServerClient(createMemberId((MemberType) val), securityServer);
} else if (val instanceof SubsystemType) {
addServerClient(clientIds.get(((SubsystemType) val).getId()), securityServer);
}
}
}
}
use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.MemberType in project X-Road by nordic-institute.
the class SharedParametersV2 method addServerClient.
private void addServerClient(ClientId client, SecurityServerType server) {
// Add the mapping from client to security server address.
if (isNotBlank(server.getAddress())) {
addToMap(memberAddresses, client, server.getAddress());
}
// Add the mapping from client to authentication certificate.
for (byte[] authCert : server.getAuthCertHash()) {
addToMap(memberAuthCerts, client, authCert);
}
MemberType owner = getOwner(server);
SecurityServerId securityServerId = SecurityServerId.create(confType.getInstanceIdentifier(), owner.getMemberClass().getCode(), owner.getMemberCode(), server.getServerCode());
addToMap(securityServerClients, securityServerId, client);
}
use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.MemberType in project X-Road by nordic-institute.
the class GlobalConfImpl method getSecurityServers.
@Override
public List<SecurityServerId> getSecurityServers(String... instanceIdentifiers) {
List<SecurityServerId> serverIds = new ArrayList<SecurityServerId>();
for (SharedParametersV2 p : getSharedParameters(instanceIdentifiers)) {
for (SecurityServerType s : p.getSecurityServers()) {
MemberType owner = SharedParametersV2.getOwner(s);
serverIds.add(SecurityServerId.create(p.getInstanceIdentifier(), owner.getMemberClass().getCode(), owner.getMemberCode(), s.getServerCode()));
}
}
return serverIds;
}
Aggregations