Search in sources :

Example 1 with SecurityServerType

use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SecurityServerType 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);
            }
        }
    }
}
Also used : SubsystemType(ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SubsystemType) MemberType(ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.MemberType) SecurityServerId(ee.ria.xroad.common.identifier.SecurityServerId) ClientId(ee.ria.xroad.common.identifier.ClientId) SecurityServerType(ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SecurityServerType)

Example 2 with SecurityServerType

use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SecurityServerType 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);
}
Also used : MemberType(ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.MemberType) SecurityServerId(ee.ria.xroad.common.identifier.SecurityServerId)

Example 3 with SecurityServerType

use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SecurityServerType in project X-Road by nordic-institute.

the class GlobalConfImpl method getSecurityServerAddress.

@Override
public String getSecurityServerAddress(SecurityServerId serverId) {
    if (serverId == null) {
        return null;
    }
    SharedParametersV2 p = getSharedParameters(serverId.getXRoadInstance());
    final SecurityServerType serverType = p.getSecurityServersById().get(serverId);
    if (serverType != null) {
        return serverType.getAddress();
    }
    return null;
}
Also used : SecurityServerType(ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SecurityServerType)

Example 4 with SecurityServerType

use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SecurityServerType 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;
}
Also used : MemberType(ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.MemberType) SecurityServerId(ee.ria.xroad.common.identifier.SecurityServerId) ArrayList(java.util.ArrayList) SecurityServerType(ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SecurityServerType)

Aggregations

MemberType (ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.MemberType)3 SecurityServerType (ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SecurityServerType)3 SecurityServerId (ee.ria.xroad.common.identifier.SecurityServerId)3 SubsystemType (ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.SubsystemType)1 ClientId (ee.ria.xroad.common.identifier.ClientId)1 ArrayList (java.util.ArrayList)1