public String getUserPassword(String user) { return manager.getUser(user).getPassword(); }
private AuthenticationFailedException newException(final String message, final Exception cause) { final String fullMessage = "PKCSAuthenticator: Authentication of client failed due to: " + message; if (cause != null) { return new AuthenticationFailedException(fullMessage, cause); } else { return new AuthenticationFailedException(fullMessage); } }
public ResourcePermission(String resource, String operation, String target, String key) { // what's eventually stored are either "*", "NULL" or a valid enum except ALL. // Fields are never null. this.resource = parsePart(resource, r -> Resource.valueOf(r).getName()); this.operation = parsePart(operation, o -> Operation.valueOf(o).getName()); if (target != null) { this.target = StringUtils.stripStart(target, Region.SEPARATOR); } if (key != null) { this.key = key; } setParts(this.resource + ":" + this.operation + ":" + this.target + ":" + this.key, true); }
@Override public boolean needsPostProcessing() { throw new NotAuthorizedException("User has not yet logged in"); } }
protected static void setJavaProps(final Properties javaProps) { removeJavaProperties(currentJavaProps); addJavaProperties(javaProps); currentJavaProps = javaProps; }
/** * Throws AuthenticationRequiredException if authentication is required but there are no * credentials. */ static void throwIfMissingRequiredCredentials(boolean requireAuthentication, boolean hasCredentials) { if (requireAuthentication && !hasCredentials) { throw new AuthenticationRequiredException( "No security credentials are provided"); } }
protected static void createCacheClient(final String authInitModule, final Properties authProps, final Properties javaProps, final int[] ports, final int numConnections, final boolean setupDynamicRegionFactory, final boolean multiUserMode, final int expectedResult) { createCacheClient(authInitModule, authProps, javaProps, ports, numConnections, setupDynamicRegionFactory, multiUserMode, true, expectedResult); }
protected static Integer createCacheServer(final Properties authProps, final Properties javaProps) { return SecurityTestUtils.createCacheServer(authProps, javaProps, 0, true, NO_EXCEPTION); }
public OperationWithAction(final OperationCode opCode, final int clientNum) { this.opCode = opCode; this.authzOpCode = opCode; this.clientNum = clientNum; this.flags = OpFlags.NONE; setIndices(4); this.opNum = 0; }
public String getName() { if (this == ALL) { return ResourcePermission.ALL; } return name(); } }
/** * * @return the credentials to be used. It needs to contain "security-username" and * "security-password" * @deprecated in Geode 1.3. Never called by the product. Use {@link #getCredentials(Properties * securityProps, DistributedMember server, boolean isPeer)} */ default Properties getCredentials(Properties securityProps) { return getCredentials(securityProps, null, true); } }
public String getName() { if (this == ALL) { return ResourcePermission.ALL; } return name(); } }
public String getName() { if (this == ALL) { return ResourcePermission.ALL; } return name(); } }
@Override public Properties getCredentials(Properties props, DistributedMember server, boolean isPeer) throws AuthenticationFailedException { throw new AuthenticationFailedException("expected get credential error"); }
protected static void createCacheClient(final String authInitModule, final Properties authProps, final Properties javaProps, final int[] ports, final int numConnections, final boolean multiUserMode, final int expectedResult) { createCacheClient(authInitModule, authProps, javaProps, ports, numConnections, false, multiUserMode, expectedResult); }
@Override public void init(LogWriter systemLogger, LogWriter securityLogger) throws AuthenticationFailedException { throw new AuthenticationFailedException("expected init error"); }
@Override public Properties getCredentials(Properties props, DistributedMember server, boolean isPeer) throws AuthenticationFailedException { throw new AuthenticationFailedException("expected get credential error"); }
@Override public void init(Properties securityProps, LogWriter systemLogger, LogWriter securityLogger) throws AuthenticationFailedException { throw new AuthenticationFailedException("expected init error"); }