@Test public void anonymousRequestNoGrants() throws Exception { Authentication authentication = mock(AnonymousAuthenticationToken.class); underTest.checkAuthorisation(authentication, ROAD_NAME, emptySet()); verify(metrics).increment("road1", ANONYMOUS, AUTHORISED); }
public void checkAuthorisation(Authentication authentication, String roadName, Set<Sensitivity> grants) throws UnknownRoadException { AuthenticationType type = AuthenticationType.of(authentication); AuthorisationOutcome outcome = ERROR; try { checkAuthorisation(authentication, roadName, grants, type); outcome = AUTHORISED; } catch (AccessDeniedException e) { outcome = UNAUTHORISED; throw e; } finally { metrics.increment(roadName, type, outcome); } }
OfframpAuthorisation { public void checkAuthorisation(Authentication authentication, String roadName, Set<Sensitivity> grants) throws UnknownRoadException { AuthenticationType type = AuthenticationType.of(authentication); AuthorisationOutcome outcome = ERROR; try { checkAuthorisation(authentication, roadName, grants, type); outcome = AUTHORISED; } catch (AccessDeniedException e) { outcome = UNAUTHORISED; throw e; } finally { metrics.increment(roadName, type, outcome); } } }
OfframpAuthorisation { public void checkAuthorisation(Authentication authentication, String roadName, Set<Sensitivity> grants) throws UnknownRoadException { AuthenticationType type = AuthenticationType.of(authentication); AuthorisationOutcome outcome = ERROR; try { checkAuthorisation(authentication, roadName, grants, type); outcome = AUTHORISED; } catch (AccessDeniedException e) { outcome = UNAUTHORISED; throw e; } finally { metrics.increment(roadName, type, outcome); } } @Autowired  OfframpAuthorisation(@Value("#{store}") Map<String, Road> store, MeterRegistry registry); }
OfframpAuthorisation { public void checkAuthorisation(Authentication authentication, String roadName, Set<Sensitivity> grants) throws UnknownRoadException { AuthenticationType type = AuthenticationType.of(authentication); AuthorisationOutcome outcome = ERROR; try { checkAuthorisation(authentication, roadName, grants, type); outcome = AUTHORISED; } catch (AccessDeniedException e) { outcome = UNAUTHORISED; throw e; } finally { metrics.increment(roadName, type, outcome); } } @Autowired  OfframpAuthorisation(@Value("#{store}") Map<String, Road> store, MeterRegistry registry); void checkAuthorisation(Authentication authentication, String roadName, Set<Sensitivity> grants); }
OfframpAuthorisation { public void checkAuthorisation(Authentication authentication, String roadName, Set<Sensitivity> grants) throws UnknownRoadException { AuthenticationType type = AuthenticationType.of(authentication); AuthorisationOutcome outcome = ERROR; try { checkAuthorisation(authentication, roadName, grants, type); outcome = AUTHORISED; } catch (AccessDeniedException e) { outcome = UNAUTHORISED; throw e; } finally { metrics.increment(roadName, type, outcome); } } @Autowired  OfframpAuthorisation(@Value("#{store}") Map<String, Road> store, MeterRegistry registry); void checkAuthorisation(Authentication authentication, String roadName, Set<Sensitivity> grants);  }