Skip to content

Commit

Permalink
Enable javac warnings in x-pack identity-provider (elastic#75450)
Browse files Browse the repository at this point in the history
  • Loading branch information
pugnascotia authored and ywangd committed Jul 30, 2021
1 parent 63894ca commit a5acac6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
4 changes: 0 additions & 4 deletions x-pack/plugin/identity-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ dependencies {
testImplementation "org.elasticsearch:mocksocket:${versions.mocksocket}"
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xlint:-unchecked"
}

tasks.named("dependencyLicenses").configure {
mapping from: /java-support|opensaml-.*/, to: 'shibboleth'
mapping from: /http.*/, to: 'httpclient'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
*/
class WildcardServiceProvider {

@SuppressWarnings("unchecked")
private static final ConstructingObjectParser<WildcardServiceProvider, Void> PARSER = new ConstructingObjectParser<>(
"wildcard_service",
args -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void testGetResponseWithoutSecondaryAuthenticationInSpInitiatedFlow() thr
assertThat(response.getSamlResponse(), containsString("InResponseTo=\"" + requestId + "\""));
}

@SuppressWarnings("unchecked")
private TransportSamlInitiateSingleSignOnAction setupTransportAction(boolean withSecondaryAuth) throws Exception {
final Settings settings = Settings.builder()
.put("path.home", createTempDir())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class UserPrivilegeResolverTests extends ESTestCase {
private UserPrivilegeResolver resolver;

@Before
@SuppressWarnings("unchecked")
public void setupTest() {
client = mock(Client.class);
securityContext = new SecurityContext(Settings.EMPTY, new ThreadContext(Settings.EMPTY));
Expand Down Expand Up @@ -158,6 +159,8 @@ private ServiceProviderPrivileges service(String appName, String resource, Funct
return new ServiceProviderPrivileges(appName, resource, roleMapping);
}

@SafeVarargs
@SuppressWarnings("unchecked")
private HasPrivilegesResponse setupHasPrivileges(String username, String appName,
Tuple<String, Tuple<String, Boolean>>... resourceActionAccess) {
final boolean isCompleteMatch = randomBoolean();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ private ServiceProviderDefaults configureIdentityProviderDefaults() {
return defaults;
}

@SuppressWarnings("unchecked")
private void mockDocument(String entityId, DocumentVersion docVersion, SamlServiceProviderDocument document) {
doAnswer(inv -> {
final Object[] args = inv.getArguments();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
import org.opensaml.security.x509.X509Credential;
import org.w3c.dom.Element;

import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringWriter;
Expand All @@ -55,6 +50,11 @@
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import static org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport.getUnmarshallerFactory;

Expand Down Expand Up @@ -87,6 +87,7 @@ public static void restoreLocale() {
}
}

@SuppressWarnings("unchecked")
protected static void mockRegisteredServiceProvider(SamlIdentityProvider idp, String entityId, SamlServiceProvider sp) {
Mockito.doAnswer(inv -> {
final Object[] args = inv.getArguments();
Expand All @@ -101,6 +102,7 @@ protected static void mockRegisteredServiceProvider(SamlIdentityProvider idp, St
Mockito.any(ActionListener.class));
}

@SuppressWarnings("unchecked")
protected static void mockRegisteredServiceProvider(SamlServiceProviderResolver resolverMock, String entityId,
SamlServiceProvider sp) {
Mockito.doAnswer(inv -> {
Expand Down

0 comments on commit a5acac6

Please sign in to comment.