Interface OAuthApplication

All Superinterfaces:
org.eclipse.lyo.server.oauth.core.Application
All Known Implementing Classes:
AbstractOAuthApplication, BrokerOAuthApplication

public interface OAuthApplication extends org.eclipse.lyo.server.oauth.core.Application
Handles authentication with the backend system.

An instance of OAuthApplication is created by OAuthFilter when the server is initialized. It is then accessible using OAuthConfiguration.getInstance().getApplication().

Clients may implement this interface.

Since:
1.3.0
See Also:
  • Method Details

    • logout

      Response logout(HttpServletRequest request)
      Logs out the currently connected user.

      Note this method is not called by the OAuthFilter class. If logout is to be supported by a server application, the application must define a logout servlet on its own calling this method.

      Parameters:
      request - the servlet request.
      Returns:
      the response of the logout.
    • sendUnauthorized

      void sendUnauthorized(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
      Sends an authorize response, in the event the user is not yet connected to the application. Implementation is recommended to send WWW-Authenticate headers or to forward to a login page if HTML content is requested. If this latter corresponds to a resource meant to be accessed from the remote application, typically a linking dialog, a resource preview or the OAuth authorization page, implementation MUST forward to the OslcOAuthService.showLoginBridgePage(java.net.URI) URL to properly handle the local authentication from the remote application.
      Parameters:
      request - the servlet request.
      response - the servlet response.
      Throws:
      IOException - if an error occurs while writing the response.
      ServletException - if an error occurs while producing the response.
      See Also:
    • getTwoLeggedOAuthIdentity

      Optional<OAuthIdentity> getTwoLeggedOAuthIdentity(HttpServletRequest request, org.eclipse.lyo.server.oauth.core.consumer.LyoOAuthConsumer consumer) throws org.eclipse.lyo.server.oauth.core.utils.UnauthorizedException
      Gets the OAuthIdentity for a consumer's functional user if it has one.
      Parameters:
      request - the servlet request.
      consumer - the consumer used for two legged OAuth.
      Returns:
      an OAuthIdentity representing the functional user associated to the consumer, Optional.empty() if no functional user is associated to the consumer.
      Throws:
      org.eclipse.lyo.server.oauth.core.utils.UnauthorizedException - if a functional user is associated to the consumer but this user cannot be found
      Since:
      3.1.0
    • getLoginUri

      URI getLoginUri(HttpServletRequest request, URI returnUri)
      Provides the login page URI with a redirection parameter to the given URI (e.g. https://{server}/app/login.jsp?os_destination=https://{server}/app/rest/oauth/login-bridge).
      Parameters:
      request - the servlet request.
      returnUri - the URI to redirect once logged-in.
      Returns:
      the login page URI with a redirection to the given URI.
      Since:
      3.7.0