# Code repository The code for the Olympus distributed Single Sign-On service is freely available [here](https://bitbucket.alexandra.dk/projects/OL/repos/olympus-identity/) where you can also find instructions on compilation. More build instructions are available [here](../getting_started/installation_and_build.md). ## Code organization The code consists of 3 separate modules: **cfp-usecase**, **core** and **rest-wrapper**. The **cfp-usecase** is a wrapper for applying the Olympus-core to a specific use-case and the **rest-wrapper** is a REST-wrapper for the client-code to allow usage of the client code directly, through REST calls. The main part of Olympus can be found in **core**, which contains code implementing both a client, servers (partial IdPs) and a verifier (Relying Party). Note that the **core** codebase includes some client and IdP code primarily intended for comparison/benchmarking (the _password jwt_ and _distributed rsa_ components). More details about the architecture can be found [here](architecture.md) ### Client The client code is implemented in the package _eu.olympus.client_ and offers lightweight and simple client code used to interact with the servers through REST. Specifically 4 different clients are implemented. #### Pesto Client This client is implemented in the class PestoClient and realizes a JWT client in the setting of multiple servers with distributed password authentication. That is, it implements a new and advanced cryptographic approach to Single Sign-On where a user sends a hidden version of their passwords to multiple servers, which verifies this through an interactive protocol. After verification the servers use a _threshold RSA signature scheme_ to construct _partial signatures_ on a JWT token they return to the user. The user then combines these partial signatures to construct a _standard_ RSA signed JWT token. Details about this can be found in [this paper](https://eprint.iacr.org/2019/1470), published at IEEE Euro Security and Privacy 2020 as part of the Olympus project. #### dp-ABC Client This client is implemented in the class PabcClient and realizes a _distributed privacy Attribute Based Credential_ client in the setting of multiple servers with distributed password authentication. That is, it implements a new and advanced cryptographic approach to Single Sign-On where a user sends a hidden version of their passwords to multiple servers, which verifies this through an interactive protocol. After verification the servers use multi-signature Pabc scheme to issue a _partial credential_ to the user. The user can then combine these partial credentials into a standard credential. The user can store this locally and later non-interactive construct randomized proofs that it holds such a valid credential and optionally also to prove that the credential contains certain attributes. This proof can be given to a verifier to assert that a user is authenticated without any linkability across different verifiers or traceability to the credential issued by the servers. Details about the dp-ABC friendly multi-signature scheme (using Pointcheval–Sanders signatures) can be found in [this paper](https://eprint.iacr.org/2020/016), published at SCN 2020 as part of the Olympus project. #### Password JWT Client This client is implemented in the class PasswordJWTClient and realizes a standard JWT client in a setting where only a _single_ server is in play. That is, it implements the standard, non-distributed, approach to Single Sign-On where a user sends their password to a server that verifies against a salted hash stored for that user's account. The server then signs a JWT token accordingly to the user's request. This class is purely used for testing and benchmarking to compare the advanced cryptographic solution with the typical approach to Single Sing-On. #### Distributed RSA Client This client is implemented in the class DistributedRSAClient and realizes a standard JWT client in the setting of multiple servers. That is, it implements the standard approach to Single Sign-On where a user sends their password to multiple servers that each verify the user's password against a salted hash stored for that user's account. However, instead of each server individually signing a JWT token, they use a _threshold RSA signature scheme_ to construct _partial signatures_ on a JWT token which they return to the user. The user then combines these partial signatures to construct a _standard_ RSA signed JWT token. This class is purely used for testing and benchmarking. ### Server The server code is implemented in the package _eu.olympus.server_ and offers code to interact will all the clients mentioned above through 3 different IdP classes, each using one of two possible Authentication Handlers underneath. One authentication handler called _PasswordAuthenticationHandler_ for handing classical password verification where a password is sent in plain to the server and verified locally (which is the case for the Password JWT and Distributed RSA clients). Another authentication handler called _PestoAuthentication_ used for distributed and secure password verification (which is the case for the Pesto Client and dp-ABC Client). #### Pesto IdP This server is implemented in the class PestoIdpImpl and realizes a distributed password verification and token issuance service. If the Pesto Client is used, then the token is a JWT token constructed using distributed RSA through the class _ThresholdRSAJWTTokenGenerator_, whereas if the Pabc Client is used, then the token is a partial credential constructed using _ThresholdPSSharesGenerator_. #### Password JWT IdP This server is implemented in the class PasswordJWTIdP and realizes a standard JWT issuance by verifying the user's password against a salted hash digest. #### Distributed RSA IdP This server is implemented in the class DistributedRSAIdP and realizes a distributed JWT issuance service based on a local verification of the user's password against a salted hash digest. ### Verifier The verifier code is implemented in the package _eu.olympus.verifier_ and offers code to verify a token constructed by the server(s) and processed at the client. Two different verifiers are implemented depended on the type of token #### JWT Verifier This verifier is implemented in the class _JWTVerifier_ and verifies a standard, RSA signed JWT token and is agnostic to whether it has been constructed in a distributed manner or by a single server. Since this is based on standards, this class is simply a wrapper for methods from the JWT library offered by Auth0.com. #### dp-ABC Verifier This verifier is implemented in the class _PSPABCVerifier_ and verifies that a randomized credential is valid. It is furthermore also able to verify certain proofs of the content of the credential the user holds, according to what the user wishes the verifier to learn. ## REST The server contact is implemented via REST with optional TLS integration. Furthermore, inter-server communication is also implemented through a (mutually authenticated) REST connection. Mapping Java classes to REST and JSON friendly objects are done through the classes in package _eu.olympus.model_, whereas the actual REST wrapping is realized through the servlet classes in package _eu.olympus.rest_, in particular _PasswordIdPServlet_ and _PestoIdPServlet_. ## Libraries Both the distributed password verification and credentials use advanced elliptic curve constructions, hence the code depends on multiple cryptographic libraries. Specifically [Bouncy Castle](https://www.bouncycastle.org) and [AMCL Miracl Core](https://github.com/miracl/core).