/** * Adds an authority to execute an operation. * * @param resource The resource the operation belongs to. * @param operation The operation. * @return This instance for command chaining. */ public AuthoritiesImpl addOperation(final String resource, final String operation) { return addOperation(resource, null, operation); }
/** * Adds an authority to execute an operation. * * @param resource The resource the operation belongs to. * @param operation The operation. * @return This instance for command chaining. */ public AuthoritiesImpl addOperation(final String resource, final String operation) { return addOperation(resource, null, operation); }
final String[] parts = operation.split(":", 2); if (parts.length == 2) { result.addOperation(parts[0], parts[1]); } else { log.debug("ignoring malformed operation spec [{}], operation name missing", operation);
/** * Verifies that the helper can create a token for a given set of * authorities and can then parse the token again. */ @Test public void testCreateAndExpandToken() { final Authorities authorities = new AuthoritiesImpl() .addResource("telemetry", "*", Activity.READ, Activity.WRITE) .addOperation("registration", "*", "assert"); final String token = helper.createToken("userA", authorities); final Jws<Claims> parsedToken = helper.expand(token); assertNotNull(parsedToken.getBody()); } }