1616import java .util .Objects ;
1717
1818
19- import com .staffbase .plugins .sdk .RemoteCall .DeleteInstanceCallHandlerInterface ;
20- import com .staffbase .plugins .sdk .RemoteCall .RemoteCallInterface ;
2119import org .apache .logging .log4j .LogManager ;
2220import org .apache .logging .log4j .Logger ;
2321
@@ -69,12 +67,6 @@ public static SSOFacade create(final RSAPublicKey rsaPublicKey) {
6967 */
7068 private JwtConsumer jwtConsumer ;
7169
72- /**
73- * An instance handling remote calls
74- */
75- private RemoteCallInterface remoteCallHandler ;
76-
77-
7870 /**********************************************
7971 * Constructors
8072 **********************************************/
@@ -90,19 +82,14 @@ public static SSOFacade create(final RSAPublicKey rsaPublicKey) {
9082 * Initialization
9183 **********************************************/
9284
93- SSOFacade initialize (final RSAPublicKey rsaPublicKey ) {
94- return this .initialize (rsaPublicKey , null );
95- }
96-
9785 /**
9886 * Initialize this component by building up the consumer for JWT using the
9987 * pre-configured secret
10088 *
10189 * @param rsaPublicKey the RSA public key to be used for verification.
102- * @param remoteCallHandler a class handling remote calls
10390 * @return Fluent interface.
10491 */
105- SSOFacade initialize (final RSAPublicKey rsaPublicKey , final RemoteCallInterface remoteCallHandler ) {
92+ SSOFacade initialize (final RSAPublicKey rsaPublicKey ) {
10693
10794 if (logger .isDebugEnabled ()) {
10895 logger .debug ("Initializing single-sign-on manager SSOFacade. " );
@@ -122,13 +109,9 @@ SSOFacade initialize(final RSAPublicKey rsaPublicKey, final RemoteCallInterface
122109 .setRequireNotBefore ()
123110 .setRequireIssuedAt ()
124111 .build ();
125-
126- this .remoteCallHandler = remoteCallHandler ;
127-
128112 return this ;
129113 }
130114
131-
132115 /**********************************************
133116 * Methods
134117 **********************************************/
@@ -175,23 +158,7 @@ public SSOData verify(final String raw) throws SSOException {
175158 }
176159
177160 // Parse and return the container data.
178- SSOData ssoData = new SSOData (jwtClaims );
179- if (ssoData .isDeleteInstanceCall () && this .remoteCallHandler != null ) {
180- boolean result = true ;
181- if (this .remoteCallHandler instanceof DeleteInstanceCallHandlerInterface ){
182- result = ((DeleteInstanceCallHandlerInterface ) this .remoteCallHandler ).deleteInstance (instanceId );
183- } else {
184- logger .warn ("Warning: An instance deletion call for instance $instanceId was not handled." );
185- }
186-
187- if (result ){
188- this .remoteCallHandler .exitSuccess ();
189- } else {
190- this .remoteCallHandler .exitFailure ();
191- }
192- exitRemoteCall ();
193- }
194- return ssoData ;
161+ return new SSOData (jwtClaims );
195162 } catch (final MalformedClaimException malformationException ) {
196163 if (logger .isFatalEnabled ()) {
197164 logger .fatal ("Encountered malformed sso attempt." , malformationException );
@@ -206,14 +173,4 @@ public SSOData verify(final String raw) throws SSOException {
206173 throw new SSOException (invalidJwtException .getMessage (), invalidJwtException );
207174 }
208175 }
209-
210-
211- /**
212- * @throws SSOException if a remote call was not handled by the user
213- */
214- private void exitRemoteCall () throws SSOException {
215- String message = "Warning: The exit procedure for a remote call was not properly handled." ;
216- logger .warn (message );
217- throw new SSOException (message );
218- }
219176}
0 commit comments