Skip to content

Commit

Permalink
fix style and bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cecemei committed Dec 18, 2024
1 parent 92077ed commit a470236
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private QueryResponse runNativeQuery(QueryRequest request, AuthenticationResult
try {
queryLifecycle.initialize(query);
AuthorizationResult authorizationResult = queryLifecycle.authorize(authResult);
if (!authorizationResult.getPermissionErrorMessage(true).isPresent()) {
if (authorizationResult.getPermissionErrorMessage(true).isPresent()) {
throw new ForbiddenException(Access.DEFAULT_ERROR_MESSAGE);
}
queryResponse = queryLifecycle.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ public SQLMetadataStorageActionHandler(
this.connector = connector;
//fully qualified references required below due to identical package names across project modules.
//noinspection UnnecessaryFullyQualifiedName
this.jsonMapper = jsonMapper.copy().addMixIn(org.apache.druid.metadata.PasswordProvider.class,
org.apache.druid.metadata.PasswordProviderRedactionMixIn.class);
this.jsonMapper = jsonMapper.copy().addMixIn(PasswordProvider.class,PasswordProviderRedactionMixIn.class);
this.entryType = types.getEntryType();
this.statusType = types.getStatusType();
this.lockType = types.getLockType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public class Access
public static final String DEFAULT_ERROR_MESSAGE = "Unauthorized";
public static final String DEFAULT_AUTHORIZED_MESSAGE = "Authorized";

public static final Access OK = Access.allow();
public static final Access DENIED = Access.deny("");
public static final Access OK = allow();
public static final Access DENIED = deny("");

private final boolean allowed;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import org.apache.druid.error.DruidException;
import org.apache.druid.java.util.common.ISE;
import org.apache.druid.java.util.common.Intervals;
import org.apache.druid.java.util.common.guava.Sequences;
Expand Down Expand Up @@ -173,8 +174,8 @@ public void testRunSimplePreauthorized()
@Test
public void testRunSimpleUnauthorized()
{
expectedException.expect(ISE.class);
expectedException.expectMessage(Access.DEFAULT_ERROR_MESSAGE);
expectedException.expect(DruidException.class);
expectedException.expectMessage("Unexpected state [UNAUTHORIZED], expecting [AUTHORIZED]");

EasyMock.expect(queryConfig.getContext()).andReturn(ImmutableMap.of()).anyTimes();
EasyMock.expect(authenticationResult.getIdentity()).andReturn(IDENTITY).anyTimes();
Expand Down

0 comments on commit a470236

Please sign in to comment.