use of org.glassfish.security.services.impl.authorization.AuthorizationServiceImpl in project Payara by payara.
the class CreateJavaMailResourceTest method setUp.
@Before
public void setUp() {
System.out.println("\n\n *** Entering setup method *** \n\n");
System.out.println("Current dir: " + System.getProperty("user.dir") + "\n");
AuthorizationService foo = new AuthorizationServiceImpl();
System.out.println("Direct instantiation: " + foo);
habitat = getHabitat();
foo = habitat.getService(AuthorizationService.class);
System.out.println("Lookup via habitat: " + foo + "\n");
resources = habitat.<Domain>getService(Domain.class).getResources();
assertTrue(resources != null);
parameters = new ParameterMap();
context = new AdminCommandContextImpl(getLogger(CreateJavaMailResourceTest.class, ADMIN_LOGGER), new PropsFileActionReporter());
cr = habitat.getService(CommandRunner.class);
assertTrue(cr != null);
}
use of org.glassfish.security.services.impl.authorization.AuthorizationServiceImpl in project Payara by payara.
the class SimpleAtzProviderTest method testService.
@Test
public void testService() throws Exception {
final AuthorizationService authorizationService = new AuthorizationServiceImpl();
Assert.assertNotNull(simpleAtzPrv);
final AzEnvironment env = new AzEnvironmentImpl();
final Attributes attrs = contextService.getEnvironmentAttributes();
for (String attrName : attrs.getAttributeNames()) {
env.addAttribute(attrName, attrs.getAttributeValue(attrName), true);
}
AzSubject azS = authorizationService.makeAzSubject(adminSubject());
AzResult rt = simpleAtzPrv.getAuthorizationDecision(azS, authorizationService.makeAzResource(URI.create("admin://some/path")), authorizationService.makeAzAction("read"), env, null);
AzResult.Decision ds = rt.getDecision();
Assert.assertEquals(AzResult.Decision.PERMIT, ds);
}
Aggregations