I'm trying to call with Auth but in my
glassfish[glassfish-embedded-all:4.1](for my JUnit tests) I see that
principal is null:
FINE: [Web-Security] Checking Web Permission with Principals : null
mar 09, 2015 9:56:40 AM
com.sun.enterprise.security.web.integration.WebSecurityManager
checkPermissionWithoutCache
FINE: [Web-Security] Web Permission =
("javax.security.jacc.WebResourcePermission" "/api/idm" "HEAD")
mar 09, 2015 9:56:40 AM
com.sun.enterprise.security.web.integration.WebSecurityManager
hasResourcePermission
FINE: [Web-Security] hasResource isGranted: false
I try 2 ways:
1) Approach:
Response.StatusType status = webTarget.path("idm").request()
.property(HTTP_AUTHENTICATION_BASIC_USERNAME, adminNetId)
.property(HTTP_AUTHENTICATION_BASIC_PASSWORD, "test")
.head().getStatusInfo();
2) Approach:
HttpAuthenticationFeature feature =
HttpAuthenticationFeature.basic(adminNetId, "test");
client.register(feature);
Response.StatusType status = webTarget.path("idm").request()
.property(HTTP_AUTHENTICATION_BASIC_USERNAME, adminNetId)
.property(HTTP_AUTHENTICATION_BASIC_PASSWORD, "test")
.head().getStatusInfo();
Is there any anther approach?
Regards, Tomaz