mirror of https://github.com/apache/nifi.git
NIFI-65:
- Code clean up. - Updating authorizeDownload(...) to accept the dnChain in the appropriate order.
This commit is contained in:
parent
7a29166d9c
commit
469502f30c
|
@ -26,7 +26,6 @@ import java.util.Comparator;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -796,13 +795,13 @@ public class ControllerFacade implements ControllerServiceProvider {
|
|||
final Map<String, String> attributes = event.getAttributes();
|
||||
|
||||
// calculate the dn chain
|
||||
final LinkedList<String> dnChain = new LinkedList<>();
|
||||
final List<String> dnChain = new ArrayList<>();
|
||||
|
||||
// build the dn chain
|
||||
NiFiUser chainedUser = user;
|
||||
do {
|
||||
// add the entry for this user
|
||||
dnChain.push(chainedUser.getDn());
|
||||
dnChain.add(chainedUser.getDn());
|
||||
|
||||
// go to the next user in the chain
|
||||
chainedUser = chainedUser.getChain();
|
||||
|
|
|
@ -142,9 +142,10 @@ public interface AuthorityProvider {
|
|||
* Determines whether the user in the specified dnChain should be able to
|
||||
* download the content for the flowfile with the specified attributes.
|
||||
*
|
||||
* The last dn in the chain is the end user that the request was issued on
|
||||
* behalf of. The previous dn's in the chain represent entities proxying the
|
||||
* user's request.
|
||||
* The first dn in the chain is the end user that the request was issued on
|
||||
* behalf of. The subsequent dn's in the chain represent entities proxying
|
||||
* the user's request with the last being the proxy that sent the current
|
||||
* request.
|
||||
*
|
||||
* @param dnChain
|
||||
* @param attributes
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DownloadAuthorization {
|
|||
*/
|
||||
private DownloadAuthorization(Result result, String explanation) {
|
||||
if (Result.Denied.equals(result) && explanation == null) {
|
||||
throw new IllegalArgumentException("An explanation is request when the download request is denied.");
|
||||
throw new IllegalArgumentException("An explanation is required when the download request is denied.");
|
||||
}
|
||||
|
||||
this.result = result;
|
||||
|
@ -74,10 +74,11 @@ public class DownloadAuthorization {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new denied DownloadAuthorization with the specified exlanation.
|
||||
* Creates a new denied DownloadAuthorization with the specified explanation.
|
||||
*
|
||||
* @param explanation
|
||||
* @return
|
||||
* @throws IllegalArgumentException if explanation is null
|
||||
*/
|
||||
public static DownloadAuthorization denied(String explanation) {
|
||||
return new DownloadAuthorization(Result.Denied, explanation);
|
||||
|
|
Loading…
Reference in New Issue