blob: 6fa97e30d636450e8450053b4e6db6543768942c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security.tls.authz;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
/**
* @author bjorncs
*/
public class AuthorizationResult {
private final Set<String> matchedPolicies;
public AuthorizationResult(Set<String> matchedPolicies) {
this.matchedPolicies = Collections.unmodifiableSet(matchedPolicies);
}
public Set<String> matchedPolicies() {
return matchedPolicies;
}
public boolean succeeded() {
return matchedPolicies.size() > 0;
}
@Override
public String toString() {
return "AuthorizationResult{" +
", matchedPolicies=" + matchedPolicies +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AuthorizationResult that = (AuthorizationResult) o;
return Objects.equals(matchedPolicies, that.matchedPolicies);
}
@Override
public int hashCode() {
return Objects.hash(matchedPolicies);
}
}
|