Package org.logevents.observers.web
Class LogEventHttpServer
- java.lang.Object
-
- org.logevents.observers.web.AbstractLogEventHttpServer
-
- org.logevents.observers.web.LogEventHttpServer
-
public class LogEventHttpServer extends AbstractLogEventHttpServer
The simplest way to expose your logs in your web browser, LogEventHttpServer runs an embedded http server in your application for the logs app console. Requires that you configure anOpenIdConfiguration
so you don't accidentally expose it insecurely. SeeOpenIdConfiguration
for details on how to set this up.Running with http (unencrypted)
The simplest way to getLogEventHttpServer
up a running is to usehttp
. However, this will probably only work for localhost, because OpenID Connect providers generally only allow apps to use http for localhost.observer.web=WebLogEventServer
- Register a
WebLogEventObserver
with anhttpPort
. (E.g.observer.web.httpPort=8080
) - Setup a
OpenIdConfiguration
(e.g.observer.web.openIdIssuer=https://login.microsoft.com
,observer.web.clientId=...
,observer.web.clientSecret=...
) - Start your application with the configuration
- Open a web browser to e.g.
http://localhost:8080/logs
. You will now be logged in with your Open ID Connect provider and the see your logs
Sample config
observer.web=WebLogEventObserver observer.web.openIdIssuer=https://login.microsoftonline.com/common observer.web.clientId=12345678-abcd-pqrs-9876-9abcdef01234 observer.web.clientSecret=3¤..¤!?qwer observer.web.source=DatabaseLogEventObserver observer.web.source.jdbcUrl=... observer.web.httpsPort=8443 observer.web.keyStore=MyCertificate.p12 observer.web.keyStorePassword=mfldnlsnaa observer.web.hostKeyPassword=2112wfsasa
-
-
Constructor Summary
Constructors Constructor Description LogEventHttpServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createSessionCookie(Map<String,Object> idToken)
CryptoVault
getCookieVault()
String
getUrl()
protected void
httpHandler(com.sun.net.httpserver.HttpExchange exchange)
void
setCookieVault(CryptoVault cookieVault)
void
setHostname(String hostname)
void
setHttpPort(Optional<Integer> httpPort)
void
setLogEventsHtml(String logEventsHtml)
void
setLogEventSource(LogEventSource logEventSource)
void
setOpenIdConfiguration(OpenIdConfiguration openIdConfiguration)
void
start()
String
toString()
-
Methods inherited from class org.logevents.observers.web.AbstractLogEventHttpServer
getCookie, getResourceFileAsString, parseParameters, sendResponse
-
-
-
-
Method Detail
-
setHostname
public void setHostname(String hostname)
-
setLogEventsHtml
public void setLogEventsHtml(String logEventsHtml)
-
setOpenIdConfiguration
public void setOpenIdConfiguration(OpenIdConfiguration openIdConfiguration)
-
setLogEventSource
public void setLogEventSource(LogEventSource logEventSource)
-
start
public void start()
-
getUrl
public String getUrl()
-
httpHandler
protected void httpHandler(com.sun.net.httpserver.HttpExchange exchange) throws IOException
- Throws:
IOException
-
getCookieVault
public CryptoVault getCookieVault()
-
setCookieVault
public void setCookieVault(CryptoVault cookieVault)
-
-