wiki:S2S_FACADE_SECURITY_R0
Last modified 16 years ago Last modified on 12/29/08 17:14:14

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=S2S_FACADE_SECURITY_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

The Sophie 2 Server Facade layer provides interface which is the same on both the server and the client sides for manipulating the resources on the server. The Facade layer accesses the Server core logic.

Task requirements

  • The basic object model of the Facade should be build. The Facade should be extendable.
  • The part of the Facade used for security purposes should be made functional.
  • The current code should be refactored to use the Facade layer.

Task result

  • Basic interfaces representing the Facade skeleton.
  • Implementations of these interfaces for the security logic that is built at the moment.
  • The current code that uses the core logic refactored to use the security implementations of the Facade interfaces.

Implementation idea

  • Build Facade interface and interfaces for all the current security logics (users, groups). The Facade interface implementations will provide implementations of these logics.
  • Implement the security facade logic for the mock server and the server itself. The login method should return session id (UUID) instead of user and the security part of the facade will keep a map in itself with sessionId -> user values.
  • Refactor the mock server, the web interface and the web services to use the newly coded security facade.

S2S_DEPLOY_TECHNOLOGIES_R0
S2S_CORE_SECURITY_R0
S2S_WEB_USER_RELATED_R0
S2S_WEB_SERVICES_R0
S2S_WEB_COMMONS_R1
S2S_CORE_MOCK_SERVER_R0
S2S_FACADE_RESOURCE_ACCESS_R0
S2S_FACADE_RESOURCE_CHANGES_R0
S2S_FACADE_LARGE_RESOURCE_ACCESS_R0
S2S_FACADE_META_ACCESS_R0

How to demo

Show the new object model, run the test and demonstrate that the refacored mock server, web interface and web services are running like before.

Design

For the implementation of the Facade there are some steps to be done.

  • First the object model must be done.
    • Here is the class diagram for the object model:

source:/trunk/sophie2-platform/modules/org.sophie2.server/doc/S2S_FACADE_SECURITY_R0.jpg

  • The Facade interface provides all the facade logics (for security, books, commenting, etc..). At that revision it is modeled to provide only the security logic represented by the UserManager and the GroupManager interfaces.
  • The server side's implementations of the facade interfaces are in the org.sophie2.server.facade.impl package.
    • The UserManager implementation - the ServerUserManager uses the ServerSession and provides access to logged user with the help of a string - session id.
    • The ServerSession class represents the Sophie 2 Server session and keeps the relations sessionId -> logged-in user. Also it takes care of the session timeouts.
  • Second the mock server must be refactored to use the new facade model. For now only its three methods for login, retrieving groups and checking existence of a user are necessary to be implemented (see S2S_CORE_MOCK_SERVER_R0). Also the test cases must be refactored. The new mock facade is shown in the class diagram.
  • The third step is to refactor the web services layer. For now there is only one web service - the UserWebService (see S2S_WEB_SERVICES_R0). It must use the ServerSession and it's session IDs for managing the users.
  • The last step is to refactor the security part of the current web to use the facade instead the core logic. The HttpSession will keep a session id instead of user and the user will be retrieved from the facade by it's session id.

Here are the unit tests:

  • The ServerSession test :

trunk/sophie2-platform/modules/org.sophie2.server/src/test/java/org/sophie2/server/facade/ServerSessionTest.java@1091

  • The mock server's refactored test :

trunk/sophie2-platform/modules/org.sophie2.server.connector/src/test/java/org/sophie2/server/connector/facade/mock/MockUserManagerTest.java@1091

  • The ServerUserManager and the ServerGroupManager tests :

trunk/sophie2-platform/modules/org.sophie2.server/src/test/java/org/sophie2/server/facade/impl/ServerUserManagerTest.java@1091
trunk/sophie2-platform/modules/org.sophie2.server/src/test/java/org/sophie2/server/facade/impl/ServerGroupManagerTest.java@1091

Implementation

The source code for that task is in changesets 1091, 1096 and 1099.

Testing

Comments

(Write comments for this or later revisions here.)