O2SecurityContext implements SecurityContext { @Override public String getAuthenticationScheme() { return principal.getScheme(); } O2SecurityContext(final O2Principal principal); @Override Principal getUserPrincipal(); @Override boolean isUserInRole(final String role); @Override boolean isSecure(); @Override String getAuthenticationScheme();  }
@Test public void getAuthenticationScheme() { Client c1 = new Client(); c1.setId(IdUtil.next()); c1.setClientSecret("secret"); O2Principal p1 = new O2Principal(c1); O2SecurityContext context1 = new O2SecurityContext(p1); assertEquals(O2AuthScheme.ClientPrivate.toString(), context1.getAuthenticationScheme()); Client c2 = new Client(); c2.setId(IdUtil.next()); O2Principal p2 = new O2Principal(c2); O2SecurityContext context2 = new O2SecurityContext(p2); assertEquals(O2AuthScheme.ClientPublic.toString(), context2.getAuthenticationScheme()); O2Principal p3 = new O2Principal(); O2SecurityContext context3 = new O2SecurityContext(p3); assertEquals(O2AuthScheme.None.toString(), context3.getAuthenticationScheme()); }