Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable javac warnings in x-pack identity-provider #75450

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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