Skip to content

Commit c598f42

Browse files
authored
Merge pull request #11902 from utle/deprecated-ltap-api
Temporary deprecated this API
2 parents 30f97af + e8a5d66 commit c598f42

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

dev/com.ibm.ws.security.token/bnd.bnd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ instrument.classesExcludes: com/ibm/ws/security/token/internal/resources/*.class
6161
com.ibm.websphere.security;version=latest,\
6262
com.ibm.ws.logging,\
6363
com.ibm.ws.kernel.service,\
64+
com.ibm.ws.kernel.boot.core;version=latest, \
6465
com.ibm.websphere.org.osgi.core,\
6566
com.ibm.websphere.org.osgi.service.component,\
6667
com.ibm.ws.common.encoder,\

dev/com.ibm.ws.security.token/src/com/ibm/wsspi/security/token/WSSecurityPropagationHelper.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.ibm.websphere.security.auth.InvalidTokenException;
2323
import com.ibm.websphere.security.auth.TokenExpiredException;
2424
import com.ibm.websphere.security.auth.ValidationFailedException;
25+
import com.ibm.ws.kernel.productinfo.ProductInfo;
2526
import com.ibm.ws.security.token.TokenManager;
2627
import com.ibm.ws.security.token.internal.ValidationResultImpl;
2728
import com.ibm.wsspi.kernel.service.utils.AtomicServiceReference;
@@ -41,6 +42,22 @@ public class WSSecurityPropagationHelper {
4142
private static final AtomicServiceReference<TokenManager> tokenManagerRef = new AtomicServiceReference<TokenManager>("tokenManager");
4243
private final static WebSphereRuntimePermission VALIDATE_TOKEN = new WebSphereRuntimePermission("validateLTPAToken");
4344

45+
// Flag tells us if the message for a call to a beta method has been issued
46+
private static boolean issuedBetaMessage = false;
47+
48+
private static void betaFenceCheck() throws UnsupportedOperationException {
49+
// Not running beta edition, throw exception
50+
if (!ProductInfo.getBetaEdition()) {
51+
throw new UnsupportedOperationException("This method is beta and is not available.");
52+
} else {
53+
// Running beta exception, issue message if we haven't already issued one for this class
54+
if (!issuedBetaMessage) {
55+
Tr.info(tc, "BETA: A beta method has been invoked for the class WSSecurityPropagationHelper for the first time.");
56+
issuedBetaMessage = !issuedBetaMessage;
57+
}
58+
}
59+
}
60+
4461
/**
4562
* <p>
4663
* This method validates an LTPA token and will return a ValidationResult object.
@@ -55,7 +72,9 @@ public class WSSecurityPropagationHelper {
5572
* @return ValidationResult
5673
* @exception ValidationFailedException
5774
**/
75+
@Deprecated
5876
public static ValidationResult validateToken(byte[] token) throws ValidationFailedException {
77+
betaFenceCheck();
5978
ValidationResult validationResult = null;
6079
java.lang.SecurityManager sm = System.getSecurityManager();
6180
if (sm != null) {

0 commit comments

Comments
 (0)