-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#79 Added wrappers for HttpAuthenticationMechanism and IdentityStore
Signed-off-by: arjantijms <[email protected]>
- Loading branch information
1 parent
2390bc2
commit b9e897e
Showing
2 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
...security/enterprise/authentication/mechanism/http/HttpAuthenticationMechanismWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2018 Payara Services Limited. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
package javax.security.enterprise.authentication.mechanism.http; | ||
|
||
import javax.security.enterprise.AuthenticationException; | ||
import javax.security.enterprise.AuthenticationStatus; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
/** | ||
* This class is an implementation of the HttpAuthenticationMechanism interface that can be | ||
* subclassed by developers wishing to provide extra or different functionality. | ||
* <p> | ||
* All methods default to calling the wrapped object. | ||
* | ||
*/ | ||
public class HttpAuthenticationMechanismWrapper implements HttpAuthenticationMechanism { | ||
|
||
private final HttpAuthenticationMechanism httpAuthenticationMechanism; | ||
|
||
public HttpAuthenticationMechanismWrapper(HttpAuthenticationMechanism httpAuthenticationMechanism) { | ||
this.httpAuthenticationMechanism = httpAuthenticationMechanism; | ||
} | ||
|
||
public HttpAuthenticationMechanism getWrapped() { | ||
return httpAuthenticationMechanism; | ||
} | ||
|
||
@Override | ||
public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, | ||
HttpMessageContext httpMessageContext) throws AuthenticationException { | ||
return getWrapped().validateRequest(request, response, httpMessageContext); | ||
} | ||
|
||
@Override | ||
public AuthenticationStatus secureResponse(HttpServletRequest request, HttpServletResponse response, | ||
HttpMessageContext httpMessageContext) throws AuthenticationException { | ||
return getWrapped().secureResponse(request, response, httpMessageContext); | ||
} | ||
|
||
@Override | ||
public void cleanSubject(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMessageContext) { | ||
getWrapped().cleanSubject(request, response, httpMessageContext); | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/javax/security/enterprise/identitystore/IdentityStoreWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2018 Payara Services Limited. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
package javax.security.enterprise.identitystore; | ||
|
||
import java.util.Set; | ||
|
||
import javax.security.enterprise.credential.Credential; | ||
|
||
/** | ||
* This class is an implementation of the IdentityStore interface that can be | ||
* subclassed by developers wishing to provide extra or different functionality. | ||
* <p> | ||
* All methods default to calling the wrapped object. | ||
* | ||
*/ | ||
public class IdentityStoreWrapper implements IdentityStore { | ||
|
||
private final IdentityStore identityStore; | ||
|
||
public IdentityStoreWrapper(IdentityStore identityStore) { | ||
this.identityStore = identityStore; | ||
} | ||
|
||
public IdentityStore getWrapped() { | ||
return identityStore; | ||
} | ||
|
||
@Override | ||
public CredentialValidationResult validate(Credential credential) { | ||
return getWrapped().validate(credential); | ||
} | ||
|
||
@Override | ||
public Set<String> getCallerGroups(CredentialValidationResult validationResult) { | ||
return getWrapped().getCallerGroups(validationResult); | ||
} | ||
|
||
@Override | ||
public int priority() { | ||
return getWrapped().priority(); | ||
} | ||
|
||
@Override | ||
public Set<ValidationType> validationTypes() { | ||
return getWrapped().validationTypes(); | ||
} | ||
|
||
} |