Class WebConnector
java.lang.Object
i5.las2peer.api.Configurable
i5.las2peer.connectors.Connector
i5.las2peer.connectors.webConnector.WebConnector
public class WebConnector
extends i5.las2peer.connectors.Connector
Starter class for registering the Web Connector at the las2peer server.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected String
protected int
static final String
static final int
static final String
static final boolean
static final int
static final int
static final int
static final int
static final int
static final boolean
static final int
static final boolean
static final boolean
protected boolean
protected int
protected int
protected int
protected int
protected int
protected String
protected String
protected boolean
static final String
static final String
protected String
protected String
protected boolean
protected boolean
static final String
-
Constructor Summary
ConstructorDescriptioncreate a new web connector instance.WebConnector
(boolean http, int httpPort, boolean https, int httpsPort) create a new web connector instance.WebConnector
(Integer httpPort) -
Method Summary
Modifier and TypeMethodDescriptioni5.las2peer.security.AgentImpl
authenticateAgent
(javax.ws.rs.core.MultivaluedMap<String, String> requestHeaders, String accessTokenQueryParam) void
destroySession
(String sessionId) void
enableHttpHttps
(boolean http, boolean https) enables/disables HTTP/HTTPsGets the currently used CA certificate.int
int
int
i5.las2peer.p2p.Node
get the node, this connector is running at / forgetOrCreateSession
(i5.las2peer.security.PassphraseAgentImpl agent) getSessionById
(String sessionid) boolean
void
Logs an error.void
Logs an error with throwable.void
logMessage
(String message) Logs a message.void
set the cross origin resource domainvoid
setCrossOriginResourceMaxAge
(int maxAge) void
setCrossOriginResourceSharing
(boolean enable) allow cross origin resource sharingvoid
setHttpPort
(Integer port) set the port for the HTTP connector to listen tovoid
setHttpsPort
(Integer port) set the port for the web connector to listen to for the secure linevoid
setLogFile
(String filename) set the log file for this connectorvoid
setLogStream
(OutputStream stream) set a stream to log all messages tovoid
setPreferLocalServices
(boolean enable) prefer local servicesvoid
setSocketTimeout
(int timeoutInMs) Deprecated.This method is no longer supported and will be removed in the future.void
setSslKeyPassword
(String password) set the SSL key passwordvoid
setSslKeystore
(String keystore) set the location of the SSL keystorevoid
start
(i5.las2peer.p2p.Node node) void
stop()
Methods inherited from class i5.las2peer.api.Configurable
getProperties, setFieldValues
-
Field Details
-
DEFAULT_HTTP_PORT
public static final int DEFAULT_HTTP_PORT- See Also:
-
WEB_CONNECTOR
- See Also:
-
httpPort
protected int httpPort -
DEFAULT_HTTPS_PORT
public static final int DEFAULT_HTTPS_PORT- See Also:
-
httpsPort
protected int httpsPort -
DEFAULT_START_HTTP
public static final boolean DEFAULT_START_HTTP- See Also:
-
startHttp
protected boolean startHttp -
DEFAULT_START_HTTPS
public static final boolean DEFAULT_START_HTTPS- See Also:
-
startHttps
protected boolean startHttps -
sslKeystore
-
sslKeyPassword
-
DEFAULT_CROSS_ORIGIN_RESOURCE_DOMAIN
- See Also:
-
crossOriginResourceDomain
-
DEFAULT_CROSS_ORIGIN_RESOURCE_MAX_AGE
public static final int DEFAULT_CROSS_ORIGIN_RESOURCE_MAX_AGE- See Also:
-
crossOriginResourceMaxAge
protected int crossOriginResourceMaxAge -
DEFAULT_ENABLE_CROSS_ORIGIN_RESOURCE_SHARING
public static final boolean DEFAULT_ENABLE_CROSS_ORIGIN_RESOURCE_SHARING- See Also:
-
enableCrossOriginResourceSharing
protected boolean enableCrossOriginResourceSharing -
DEFAULT_ONLY_LOCAL_SERVICES
public static final boolean DEFAULT_ONLY_LOCAL_SERVICES- See Also:
-
onlyLocalServices
protected boolean onlyLocalServices -
SESSION_COOKIE
- See Also:
-
DEFAULT_DEFAULT_OIDC_PROVIDER
- See Also:
-
defaultOIDCProvider
-
oidcProviders
-
oidcClientId
-
oidcClientSecret
-
DEFAULT_MAX_CONNECTIONS
public static final int DEFAULT_MAX_CONNECTIONS- See Also:
-
maxConnections
protected int maxConnections -
COOKIE_SESSIONID_KEY
- See Also:
-
DEFAULT_SESSION_TIMEOUT
public static final int DEFAULT_SESSION_TIMEOUT- See Also:
-
DEFAULT_MAX_THREADS
public static final int DEFAULT_MAX_THREADS- See Also:
-
maxThreads
protected int maxThreads -
DEFAULT_MAX_REQUEST_BODY_SIZE
public static final int DEFAULT_MAX_REQUEST_BODY_SIZE- See Also:
-
maxRequestBodySize
protected int maxRequestBodySize -
SSL_INSTANCE_NAME
- See Also:
-
oidcProviderInfos
-
-
Constructor Details
-
WebConnector
public WebConnector()create a new web connector instance. -
WebConnector
public WebConnector(boolean http, int httpPort, boolean https, int httpsPort) create a new web connector instance.- Parameters:
http
-httpPort
-https
-httpsPort
-
-
WebConnector
-
-
Method Details
-
setLogFile
set the log file for this connector- Parameters:
filename
-- Throws:
IOException
-
setHttpPort
set the port for the HTTP connector to listen to- Parameters:
port
-
-
setHttpsPort
set the port for the web connector to listen to for the secure line- Parameters:
port
-
-
enableHttpHttps
public void enableHttpHttps(boolean http, boolean https) enables/disables HTTP/HTTPs- Parameters:
http
- enable HTTPhttps
- enable HTTPS
-
setSocketTimeout
Deprecated.This method is no longer supported and will be removed in the future.- Parameters:
timeoutInMs
-
-
setLogStream
set a stream to log all messages to- Parameters:
stream
-
-
setSslKeyPassword
set the SSL key password- Parameters:
password
-
-
setSslKeystore
set the location of the SSL keystore- Parameters:
keystore
-
-
setCrossOriginResourceDomain
set the cross origin resource domain- Parameters:
cord
-
-
getCrossOriginResourceDomain
-
setCrossOriginResourceMaxAge
public void setCrossOriginResourceMaxAge(int maxAge) -
getCrossOriginResourceMaxAge
public int getCrossOriginResourceMaxAge() -
setCrossOriginResourceSharing
public void setCrossOriginResourceSharing(boolean enable) allow cross origin resource sharing- Parameters:
enable
-
-
isCrossOriginResourceSharing
public boolean isCrossOriginResourceSharing() -
setPreferLocalServices
public void setPreferLocalServices(boolean enable) prefer local services- Parameters:
enable
-
-
start
public void start(i5.las2peer.p2p.Node node) throws i5.las2peer.connectors.ConnectorException - Specified by:
start
in classi5.las2peer.connectors.Connector
- Throws:
i5.las2peer.connectors.ConnectorException
-
getRootCAFilename
-
getMyHostname
-
getHttpsEndpoint
-
getHttpEndpoint
-
stop
public void stop() throws i5.las2peer.connectors.ConnectorException- Specified by:
stop
in classi5.las2peer.connectors.Connector
- Throws:
i5.las2peer.connectors.ConnectorException
-
getL2pNode
public i5.las2peer.p2p.Node getL2pNode()get the node, this connector is running at / for- Returns:
- the Las2Peer node of this connector
-
logMessage
Logs a message.- Parameters:
message
-
-
logError
Logs an error with throwable.- Parameters:
message
-throwable
-
-
logError
Logs an error.- Parameters:
message
-
-
getLockOidc
-
getOidcClientId
-
getOidcClientSecret
-
getHttpPort
public int getHttpPort() -
getHttpsPort
public int getHttpsPort() -
getCACertificate
Gets the currently used CA certificate.- Returns:
- Returns the CA certificate or
null
, if the connector is not started. - Throws:
FileNotFoundException
- If the certificate is not stored in the local keystore.
-
authenticateAgent
-
getOrCreateSession
-
getSessionById
-
destroySession
-
generateToken
-