Skip to content

Commit

Permalink
Merge pull request #11902 from utle/deprecated-ltap-api
Browse files Browse the repository at this point in the history
Temporary deprecated this API
  • Loading branch information
jhanders34 authored Apr 29, 2020
2 parents 30f97af + e8a5d66 commit c598f42
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/com.ibm.ws.security.token/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ instrument.classesExcludes: com/ibm/ws/security/token/internal/resources/*.class
com.ibm.websphere.security;version=latest,\
com.ibm.ws.logging,\
com.ibm.ws.kernel.service,\
com.ibm.ws.kernel.boot.core;version=latest, \
com.ibm.websphere.org.osgi.core,\
com.ibm.websphere.org.osgi.service.component,\
com.ibm.ws.common.encoder,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.ibm.websphere.security.auth.InvalidTokenException;
import com.ibm.websphere.security.auth.TokenExpiredException;
import com.ibm.websphere.security.auth.ValidationFailedException;
import com.ibm.ws.kernel.productinfo.ProductInfo;
import com.ibm.ws.security.token.TokenManager;
import com.ibm.ws.security.token.internal.ValidationResultImpl;
import com.ibm.wsspi.kernel.service.utils.AtomicServiceReference;
Expand All @@ -41,6 +42,22 @@ public class WSSecurityPropagationHelper {
private static final AtomicServiceReference<TokenManager> tokenManagerRef = new AtomicServiceReference<TokenManager>("tokenManager");
private final static WebSphereRuntimePermission VALIDATE_TOKEN = new WebSphereRuntimePermission("validateLTPAToken");

// Flag tells us if the message for a call to a beta method has been issued
private static boolean issuedBetaMessage = false;

private static void betaFenceCheck() throws UnsupportedOperationException {
// Not running beta edition, throw exception
if (!ProductInfo.getBetaEdition()) {
throw new UnsupportedOperationException("This method is beta and is not available.");
} else {
// Running beta exception, issue message if we haven't already issued one for this class
if (!issuedBetaMessage) {
Tr.info(tc, "BETA: A beta method has been invoked for the class WSSecurityPropagationHelper for the first time.");
issuedBetaMessage = !issuedBetaMessage;
}
}
}

/**
* <p>
* This method validates an LTPA token and will return a ValidationResult object.
Expand All @@ -55,7 +72,9 @@ public class WSSecurityPropagationHelper {
* @return ValidationResult
* @exception ValidationFailedException
**/
@Deprecated
public static ValidationResult validateToken(byte[] token) throws ValidationFailedException {
betaFenceCheck();
ValidationResult validationResult = null;
java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) {
Expand Down

0 comments on commit c598f42

Please sign in to comment.