Why do it?
LuciadLightspeed includes an OGC Web Client Suite API, which allows you to connect your LuciadLightspeed-based application with OGC web services. In practice, such web services are frequently access-restricted: they require authentication through a user name and a password before they grant access.
How to do it?
In this article, we focus on HTTP Basic Authentication, a simple but common authentication approach for HTTP-based communication. Within this approach, a service informs the client of an authentication requirement through an HTTP response code. The client then supplies the required credentials through an HTTP header encoded with Base64.
|
If you are using Lucy as your OGC client, it will automatically show a login panel when an OGC service requires credentials. |
If you are working directly with the LuciadLightspeed API, you have to supply credentials as follows:
-
Create a
TLcdOWSHttpTransportinstance and supply the credentials through the constructor. The classTLcdOWSHttpTransportis used by the OGC Web Client Suite to handle the communication with a service. -
Use the
TLcdOWSHttpTransportinstance to create a model for the OGC web service. The type of OGC service determines how you can create the model:-
WMTS: supply the transport to the constructor of
TLcdWMTSModelDecoder. -
WCS: supply the transport to one of the
createWCSClient()methods inTLcdWCSClient; ; you can supply the resultingTLcdWCSClientinstance to one of thecreateProxyModel()methods inTLcdWCSProxyModelFactory. -
WFS: supply the transport to one of the
createWFSClient()methods inTLcdWFSClient; you can supply the resultingTLcdWFSClientinstance to one of thecreateProxyModel()methods inTLcdWFSProxyModelFactory. -
WMS: supply the transport to one of the
createWMSClient()methods inTLcdWMSClient; you can supply the resultingTLcdWMSClientinstance to thedecode()method ofTLcdOGCWMSProxyModelDecoder.
-