Search in sources :

Example 1 with KEY_USER_CREDENTIAL_MAPPING

use of com.adeptj.runtime.server.ServerConstants.KEY_USER_CREDENTIAL_MAPPING in project adeptj-runtime by AdeptJ.

the class Server method populateCredentialsStore.

private void populateCredentialsStore(Config undertowConf) {
    try (MVStore store = MVStore.open(MV_CREDENTIALS_STORE)) {
        MVMap<String, String> credentials = store.openMap(H2_MAP_ADMIN_CREDENTIALS);
        // put the default password only when it is not set from web console.
        undertowConf.getObject(KEY_USER_CREDENTIAL_MAPPING).entrySet().stream().filter(entry -> StringUtils.isEmpty(credentials.get(entry.getKey()))).forEach(entry -> credentials.put(entry.getKey(), ((String) entry.getValue().unwrapped()).substring(PWD_START_INDEX)));
    }
}
Also used : MVStore(org.h2.mvstore.MVStore) KEY_HTTPS(com.adeptj.runtime.server.ServerConstants.KEY_HTTPS) RequestLimit(io.undertow.server.handlers.RequestLimit) SSLContext(javax.net.ssl.SSLContext) KEY_HTTP_ONLY(com.adeptj.runtime.server.ServerConstants.KEY_HTTP_ONLY) LogbackManagerHolder(com.adeptj.runtime.common.LogbackManagerHolder) StringUtils(org.apache.commons.lang3.StringUtils) HttpString(io.undertow.util.HttpString) KEY_LOGBACK_STATUS_SERVLET_PATH(com.adeptj.runtime.common.Constants.KEY_LOGBACK_STATUS_SERVLET_PATH) Environment(com.adeptj.runtime.common.Environment) GeneralSecurityException(java.security.GeneralSecurityException) REALM(com.adeptj.runtime.server.ServerConstants.REALM) KEY_ERROR_HANDLER_CODES(com.adeptj.runtime.common.Constants.KEY_ERROR_HANDLER_CODES) Path(java.nio.file.Path) ATTRIBUTE_BUNDLE_CONTEXT(com.adeptj.runtime.common.Constants.ATTRIBUTE_BUNDLE_CONTEXT) WORKER_TASK_CORE_THREADS(org.xnio.Options.WORKER_TASK_CORE_THREADS) MV_CREDENTIALS_STORE(com.adeptj.runtime.common.Constants.MV_CREDENTIALS_STORE) KEY_ERROR_HANDLER_PATH(com.adeptj.runtime.common.Constants.KEY_ERROR_HANDLER_PATH) AllowedMethodsHandler(io.undertow.server.handlers.AllowedMethodsHandler) Set(java.util.Set) KEY_WORKER_OPTIONS(com.adeptj.runtime.server.ServerConstants.KEY_WORKER_OPTIONS) LOGBACK_STATUS_SERVLET_NAME(com.adeptj.runtime.server.ServerConstants.LOGBACK_STATUS_SERVLET_NAME) KEY_PORT(com.adeptj.runtime.common.Constants.KEY_PORT) SYS_PROP_SERVER_HTTPS_PORT(com.adeptj.runtime.server.ServerConstants.SYS_PROP_SERVER_HTTPS_PORT) ContextPathPredicate(com.adeptj.runtime.predicate.ContextPathPredicate) KEY_HTTP(com.adeptj.runtime.common.Constants.KEY_HTTP) SYS_PROP_REQ_BUFF_MAX_BUFFERS(com.adeptj.runtime.server.ServerConstants.SYS_PROP_REQ_BUFF_MAX_BUFFERS) WORKER_TASK_MAX_THREADS(org.xnio.Options.WORKER_TASK_MAX_THREADS) KEY_HEALTH_CHECK_HANDLER_PATH(com.adeptj.runtime.server.ServerConstants.KEY_HEALTH_CHECK_HANDLER_PATH) KEY_WORKER_TASK_CORE_THREADS(com.adeptj.runtime.server.ServerConstants.KEY_WORKER_TASK_CORE_THREADS) ArrayList(java.util.ArrayList) RedirectHandler(io.undertow.server.handlers.RedirectHandler) Servlets(io.undertow.servlet.Servlets) KEY_AUTH_ROLES(com.adeptj.runtime.server.ServerConstants.KEY_AUTH_ROLES) MVStore(org.h2.mvstore.MVStore) ServletSessionConfig(io.undertow.servlet.api.ServletSessionConfig) SYS_PROP_SESSION_TIMEOUT(com.adeptj.runtime.server.ServerConstants.SYS_PROP_SESSION_TIMEOUT) KEY_INVALIDATE_SESSION_ON_LOGOUT(com.adeptj.runtime.server.ServerConstants.KEY_INVALIDATE_SESSION_ON_LOGOUT) KEY_MULTIPART_MAX_REQUEST_SIZE(com.adeptj.runtime.server.ServerConstants.KEY_MULTIPART_MAX_REQUEST_SIZE) KEY_WORKER_TASK_MAX_THREADS(com.adeptj.runtime.server.ServerConstants.KEY_WORKER_TASK_MAX_THREADS) WORKER_TASK_THREAD_MULTIPLIER(com.adeptj.runtime.server.ServerConstants.WORKER_TASK_THREAD_MULTIPLIER) Times(com.adeptj.runtime.common.Times) DEFAULT_WAIT_TIME(com.adeptj.runtime.server.ServerConstants.DEFAULT_WAIT_TIME) LinkedHashSet(java.util.LinkedHashSet) SYS_TASK_THREAD_MULTIPLIER(com.adeptj.runtime.server.ServerConstants.SYS_TASK_THREAD_MULTIPLIER) SYS_PROP_OVERWRITE_SERVER_CONF(com.adeptj.runtime.common.Constants.SYS_PROP_OVERWRITE_SERVER_CONF) KEY_MULTIPART_FILE_SIZE_THRESHOLD(com.adeptj.runtime.server.ServerConstants.KEY_MULTIPART_FILE_SIZE_THRESHOLD) Config(com.typesafe.config.Config) Files(java.nio.file.Files) SERVER_STRING(io.undertow.util.Headers.SERVER_STRING) SYS_PROP_MAX_CONCUR_REQ(com.adeptj.runtime.server.ServerConstants.SYS_PROP_MAX_CONCUR_REQ) KEY_HOST(com.adeptj.runtime.common.Constants.KEY_HOST) SYS_PROP_WORKER_TASK_THREAD_MULTIPLIER(com.adeptj.runtime.server.ServerConstants.SYS_PROP_WORKER_TASK_THREAD_MULTIPLIER) KEY_REQ_LIMIT_QUEUE_SIZE(com.adeptj.runtime.common.Constants.KEY_REQ_LIMIT_QUEUE_SIZE) IOException(java.io.IOException) KEY_SYSTEM_CONSOLE_PATH(com.adeptj.runtime.common.Constants.KEY_SYSTEM_CONSOLE_PATH) KEY_PROTECTED_PATHS_SECURED_FOR_METHODS(com.adeptj.runtime.server.ServerConstants.KEY_PROTECTED_PATHS_SECURED_FOR_METHODS) H2_MAP_ADMIN_CREDENTIALS(com.adeptj.runtime.common.Constants.H2_MAP_ADMIN_CREDENTIALS) Lifecycle(com.adeptj.runtime.common.Lifecycle) RequestLimitingHandler(io.undertow.server.handlers.RequestLimitingHandler) RequestBufferingHandler(io.undertow.server.handlers.RequestBufferingHandler) KEY_MULTIPART_MAX_FILE_SIZE(com.adeptj.runtime.server.ServerConstants.KEY_MULTIPART_MAX_FILE_SIZE) SYS_PROP_ENABLE_REQ_BUFF(com.adeptj.runtime.server.ServerConstants.SYS_PROP_ENABLE_REQ_BUFF) SYS_PROP_SHUTDOWN_WAIT_TIME(com.adeptj.runtime.server.ServerConstants.SYS_PROP_SHUTDOWN_WAIT_TIME) ServletContext(javax.servlet.ServletContext) GracefulShutdownHandler(io.undertow.server.handlers.GracefulShutdownHandler) KEY_DEFAULT_ENCODING(com.adeptj.runtime.server.ServerConstants.KEY_DEFAULT_ENCODING) HealthCheckHandler(com.adeptj.runtime.handler.HealthCheckHandler) DEPLOYMENT_NAME(com.adeptj.runtime.common.Constants.DEPLOYMENT_NAME) Handlers(io.undertow.Handlers) KEY_USE_CACHED_AUTH_MECHANISM(com.adeptj.runtime.server.ServerConstants.KEY_USE_CACHED_AUTH_MECHANISM) LoggerFactory(org.slf4j.LoggerFactory) SYS_PROP_SYS_TASK_THREAD_MULTIPLIER(com.adeptj.runtime.server.ServerConstants.SYS_PROP_SYS_TASK_THREAD_MULTIPLIER) RuntimeInitializer(com.adeptj.runtime.core.RuntimeInitializer) ServletInfo(io.undertow.servlet.api.ServletInfo) SLF4JBridgeHandler(org.slf4j.bridge.SLF4JBridgeHandler) Undertow(io.undertow.Undertow) KEY_ADMIN_SERVLET_PATH(com.adeptj.runtime.common.Constants.KEY_ADMIN_SERVLET_PATH) KEY_IGNORE_FLUSH(com.adeptj.runtime.server.ServerConstants.KEY_IGNORE_FLUSH) IOUtils(com.adeptj.runtime.common.IOUtils) KEY_HEADER_SERVER(com.adeptj.runtime.common.Constants.KEY_HEADER_SERVER) MVMap(org.h2.mvstore.MVMap) KEY_USER_CREDENTIAL_MAPPING(com.adeptj.runtime.server.ServerConstants.KEY_USER_CREDENTIAL_MAPPING) ErrorPage(io.undertow.servlet.api.ErrorPage) KEY_ALLOWED_METHODS(com.adeptj.runtime.common.Constants.KEY_ALLOWED_METHODS) KEY_MULTIPART_FILE_LOCATION(com.adeptj.runtime.server.ServerConstants.KEY_MULTIPART_FILE_LOCATION) KEY_REQ_BUFF_MAX_BUFFERS(com.adeptj.runtime.common.Constants.KEY_REQ_BUFF_MAX_BUFFERS) ADMIN_LOGIN_URI(com.adeptj.runtime.common.Constants.ADMIN_LOGIN_URI) Configs(com.adeptj.runtime.config.Configs) MultipartConfigElement(javax.servlet.MultipartConfigElement) Collectors(java.util.stream.Collectors) KEY_MAX_CONCURRENT_REQUESTS(com.adeptj.runtime.common.Constants.KEY_MAX_CONCURRENT_REQUESTS) BundleContextHolder(com.adeptj.runtime.common.BundleContextHolder) List(java.util.List) BANNER_TXT(com.adeptj.runtime.common.Constants.BANNER_TXT) KEY_CONTEXT_PATH(com.adeptj.runtime.server.ServerConstants.KEY_CONTEXT_PATH) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo) ADMIN_SERVLET_NAME(com.adeptj.runtime.server.ServerConstants.ADMIN_SERVLET_NAME) CrawlerSessionManagerConfig(io.undertow.servlet.api.CrawlerSessionManagerConfig) FORM_AUTH(javax.servlet.http.HttpServletRequest.FORM_AUTH) ERROR_SERVLET_NAME(com.adeptj.runtime.server.ServerConstants.ERROR_SERVLET_NAME) SYS_PROP_REQ_LIMIT_QUEUE_SIZE(com.adeptj.runtime.server.ServerConstants.SYS_PROP_REQ_LIMIT_QUEUE_SIZE) PathHandler(io.undertow.server.handlers.PathHandler) ViewStatusMessagesServlet(ch.qos.logback.classic.ViewStatusMessagesServlet) SecurityConstraint(io.undertow.servlet.api.SecurityConstraint) PredicateHandler(io.undertow.server.handlers.PredicateHandler) KEY_PROTECTED_PATHS(com.adeptj.runtime.server.ServerConstants.KEY_PROTECTED_PATHS) SERVER_CONF_CP_RESOURCE(com.adeptj.runtime.common.Constants.SERVER_CONF_CP_RESOURCE) SYS_PROP_ENABLE_HTTP2(com.adeptj.runtime.server.ServerConstants.SYS_PROP_ENABLE_HTTP2) RuntimeInitializationException(com.adeptj.runtime.exception.RuntimeInitializationException) ServletInitialHandlerWrapper(com.adeptj.runtime.handler.ServletInitialHandlerWrapper) SYS_PROP_SERVER_PORT(com.adeptj.runtime.common.Constants.SYS_PROP_SERVER_PORT) KEY_SESSION_TIMEOUT(com.adeptj.runtime.server.ServerConstants.KEY_SESSION_TIMEOUT) Logger(org.slf4j.Logger) SslContextFactory(com.adeptj.runtime.common.SslContextFactory) AdminServlet(com.adeptj.runtime.servlet.AdminServlet) ErrorServlet(com.adeptj.runtime.servlet.ErrorServlet) DeploymentManager(io.undertow.servlet.api.DeploymentManager) HttpHandler(io.undertow.server.HttpHandler) FrameworkLauncher(com.adeptj.runtime.osgi.FrameworkLauncher) PWD_START_INDEX(com.adeptj.runtime.server.ServerConstants.PWD_START_INDEX) ServletContainerInitializerInfo(io.undertow.servlet.api.ServletContainerInitializerInfo) KEY_CHANGE_SESSION_ID_ON_LOGIN(com.adeptj.runtime.server.ServerConstants.KEY_CHANGE_SESSION_ID_ON_LOGIN) SetHeaderHandler(io.undertow.server.handlers.SetHeaderHandler) InputStream(java.io.InputStream) HttpString(io.undertow.util.HttpString)

Aggregations

ViewStatusMessagesServlet (ch.qos.logback.classic.ViewStatusMessagesServlet)1 BundleContextHolder (com.adeptj.runtime.common.BundleContextHolder)1 ADMIN_LOGIN_URI (com.adeptj.runtime.common.Constants.ADMIN_LOGIN_URI)1 ATTRIBUTE_BUNDLE_CONTEXT (com.adeptj.runtime.common.Constants.ATTRIBUTE_BUNDLE_CONTEXT)1 BANNER_TXT (com.adeptj.runtime.common.Constants.BANNER_TXT)1 DEPLOYMENT_NAME (com.adeptj.runtime.common.Constants.DEPLOYMENT_NAME)1 H2_MAP_ADMIN_CREDENTIALS (com.adeptj.runtime.common.Constants.H2_MAP_ADMIN_CREDENTIALS)1 KEY_ADMIN_SERVLET_PATH (com.adeptj.runtime.common.Constants.KEY_ADMIN_SERVLET_PATH)1 KEY_ALLOWED_METHODS (com.adeptj.runtime.common.Constants.KEY_ALLOWED_METHODS)1 KEY_ERROR_HANDLER_CODES (com.adeptj.runtime.common.Constants.KEY_ERROR_HANDLER_CODES)1 KEY_ERROR_HANDLER_PATH (com.adeptj.runtime.common.Constants.KEY_ERROR_HANDLER_PATH)1 KEY_HEADER_SERVER (com.adeptj.runtime.common.Constants.KEY_HEADER_SERVER)1 KEY_HOST (com.adeptj.runtime.common.Constants.KEY_HOST)1 KEY_HTTP (com.adeptj.runtime.common.Constants.KEY_HTTP)1 KEY_LOGBACK_STATUS_SERVLET_PATH (com.adeptj.runtime.common.Constants.KEY_LOGBACK_STATUS_SERVLET_PATH)1 KEY_MAX_CONCURRENT_REQUESTS (com.adeptj.runtime.common.Constants.KEY_MAX_CONCURRENT_REQUESTS)1 KEY_PORT (com.adeptj.runtime.common.Constants.KEY_PORT)1 KEY_REQ_BUFF_MAX_BUFFERS (com.adeptj.runtime.common.Constants.KEY_REQ_BUFF_MAX_BUFFERS)1 KEY_REQ_LIMIT_QUEUE_SIZE (com.adeptj.runtime.common.Constants.KEY_REQ_LIMIT_QUEUE_SIZE)1 KEY_SYSTEM_CONSOLE_PATH (com.adeptj.runtime.common.Constants.KEY_SYSTEM_CONSOLE_PATH)1