Search in sources :

Example 6 with HttpConnectionInformation

use of com.evolveum.midpoint.security.api.HttpConnectionInformation in project midpoint by Evolveum.

the class SecurityHelper method storeConnectionEnvironment.

private void storeConnectionEnvironment(AuditEventRecord record, ConnectionEnvironment connEnv) {
    record.setChannel(connEnv.getChannel());
    record.setSessionIdentifier(connEnv.getSessionId());
    HttpConnectionInformation connInfo = connEnv.getConnectionInformation();
    if (connInfo != null) {
        record.setRemoteHostAddress(connInfo.getRemoteHostAddress());
        record.setHostIdentifier(connInfo.getLocalHostName());
    }
}
Also used : HttpConnectionInformation(com.evolveum.midpoint.security.api.HttpConnectionInformation)

Example 7 with HttpConnectionInformation

use of com.evolveum.midpoint.security.api.HttpConnectionInformation in project midpoint by Evolveum.

the class MidpointFunctionsImpl method getPublicHttpUrlPattern.

private String getPublicHttpUrlPattern() {
    SystemConfigurationType systemConfiguration;
    try {
        systemConfiguration = modelInteractionService.getSystemConfiguration(getCurrentResult());
    } catch (ObjectNotFoundException | SchemaException e) {
        LOGGER.error("Error while getting system configuration. ", e);
        return null;
    }
    if (systemConfiguration == null) {
        LOGGER.trace("No system configuration defined. Skipping link generation.");
        return null;
    }
    String host = null;
    HttpConnectionInformation connectionInf = SecurityUtil.getCurrentConnectionInformation();
    if (connectionInf != null) {
        host = connectionInf.getServerName();
    }
    String publicHttpUrlPattern = SystemConfigurationTypeUtil.getPublicHttpUrlPattern(systemConfiguration, host);
    if (StringUtils.isBlank(publicHttpUrlPattern)) {
        LOGGER.error("No patern defined. It can break link generation.");
    }
    return publicHttpUrlPattern;
}
Also used : HttpConnectionInformation(com.evolveum.midpoint.security.api.HttpConnectionInformation) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Aggregations

HttpConnectionInformation (com.evolveum.midpoint.security.api.HttpConnectionInformation)7 SecurityContextManager (com.evolveum.midpoint.security.api.SecurityContextManager)3 Collection (java.util.Collection)3 Authentication (org.springframework.security.core.Authentication)3 ModelInteractionService (com.evolveum.midpoint.model.api.ModelInteractionService)2 ModelService (com.evolveum.midpoint.model.api.ModelService)2 ModelContext (com.evolveum.midpoint.model.api.context.ModelContext)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 CommonException (com.evolveum.midpoint.util.exception.CommonException)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 AsyncWebProcessManager (com.evolveum.midpoint.web.application.AsyncWebProcessManager)2 SecurityContextAwareCallable (com.evolveum.midpoint.web.component.SecurityContextAwareCallable)2 MidPointApplication (com.evolveum.midpoint.web.security.MidPointApplication)2 AuditEventRecord (com.evolveum.midpoint.audit.api.AuditEventRecord)1 AuditResultHandler (com.evolveum.midpoint.audit.api.AuditResultHandler)1 AuditService (com.evolveum.midpoint.audit.api.AuditService)1 AuditServiceRegistry (com.evolveum.midpoint.audit.spi.AuditServiceRegistry)1 PrismContext (com.evolveum.midpoint.prism.PrismContext)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1