The resin authenticators that Caucho provides will not help in federation. Instead, you need to add ServletFilter, which searches for unverified users. When he finds him, you must direct them to the login page. You should ask the user if they want to log in directly to your site or join another organization. (This can be done by displaying the username and password form + logos of trusted third-party organizations.) In the first case of direct login, use the Resin Authenticator to check the local user against your replication or, nevertheless, you are doing it now. For a federated case, use SAML.
Federation will begin by sending a request for authentication of a trusted partner (ADFS server). This is a small XML document packaged in a form that will require several things that need to be changed for each request (for example, creation time). This can be done using String.format - nothing complicated. Send this authentication request to the SAML server (for example, ADFS) in the organization that the user selected. They will log in and send an authentication response to some of the "Assertion Consumer Service" that you need to create.
ACS is the only endpoint that receives a SAML authentication response. It must be an unauthenticated endpoint that will analyze and verify the response from ADFS. Use OpenSAML for this. There are many things that you need to do to make sure that this is true. For example, you must verify the digital signature of the approval. You also need to check the time of the problem so that it does not happen in the future. Make sure that this statement is for you by checking the addressee in the confirmation data, audience and recipient. Etc.
If this goes beyond what you would like to code, check the open or commercial SAML server. It must function as an SP and must work in Resin so that everything is simple. One candidate, medium and thin, Asimba . ( The company for which I work is the developer of this project.) You can deploy this to Resin, and he will take care of the request and response.
OAuth Note
What you are considering here is a federation (or web one time subscription). OAuth is not suitable for federation. This is a protocol for delegating authority. The OpenID Foundation has expanded OAuth 2 to support federation in the OpenID Connect OAuth profile. ADFS does not support this federation protocol and is limited to WS-Federation and SAML. Therefore, you should not look into OAuth if ADFS will be used by your partners.
source share