users@glassfish.java.net

[gf-users] Re: v4 Programatic login

From: Tomaz Majerhold <tomaz.majerhold_at_arnes.si>
Date: Fri, 23 May 2014 08:55:23 +0200

I know, I'm using it from security-ee.jar and then I'm getting this 2
errors which I don't understand them:

1)
SEVERE: Exception while loading the app : CDI deployment
failure:WELD-001301 Annotation
@org.glassfish.api.admin.RestEndpoints(value=[@org.glassfish.api.admin.RestEndpoint(description=delete-resource-ref,
path=delete-resource-ref, opType=DELETE, params=[],
useForAuthorization=false, configBean=interface
com.sun.enterprise.config.serverbeans.Resources)]) is not a qualifier
org.jboss.weld.exceptions.IllegalArgumentException: WELD-001301
Annotation
@org.glassfish.api.admin.RestEndpoints(value=[@org.glassfish.api.admin.RestEndpoint(description=delete-resource-ref,
path=delete-resource-ref, opType=DELETE, params=[],
useForAuthorization=false, configBean=interface
com.sun.enterprise.config.serverbeans.Resources)]) is not a qualifier
     at
org.jboss.weld.resolution.ResolvableBuilder.checkQualifier(ResolvableBuilder.java:209)

....
at
com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
     at java.security.AccessController.doPrivileged(Native Method)
     at javax.security.auth.Subject.doAs(Subject.java:356)
     at
com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
....

2)
SEVERE: Exception while loading the app : CDI definition
failure:WELD-000071 Managed bean class
com.sun.enterprise.security.audit.BaseAuditManager must be @Dependent
org.jboss.weld.exceptions.DefinitionException: WELD-000071 Managed bean
class com.sun.enterprise.security.audit.BaseAuditManager must be @Dependent
     at org.jboss.weld.bean.ManagedBean.checkType(ManagedBean.java:205)
.....
at java.security.AccessController.doPrivileged(Native Method)
     at javax.security.auth.Subject.doAs(Subject.java:356)
......


In my web application I never using CDI of any kind RestEndpoints or
BaseAuditManager . So I suspect something is wrong about security, but I
can't figure it out

I also have in server.policy
grant codeBase "file:${com.sun.aas.installRoot}/modules/-" {
     permission
com.sun.enterprise.security.ee.auth.login.ProgrammaticLoginPermission
"login";
};

Regards, Tomaz

Dne 23.5.2014 0:56, piše David Wheeler:
> ProgrammaticLogin has moved packages since glassfish 3
>
> http://stackoverflow.com/questions/17571932/glassfish-4-programmatic-login
>
> -- David
>
> On 22 May 2014, at 8:25 pm, Tomaz Majerhold <tomaz.majerhold_at_arnes.si
> <mailto:tomaz.majerhold_at_arnes.si>> wrote:
>
>> Is there any documentation how to use remote EJB security using realm
>> for authentication ?
>>
>> This should one of the base of application server!
>>
>> Regards, Tomaz
>>
>> Dne 22.5.2014 11:13, piše Tomaz Majerhold:
>>> Do any body know what this masaage mean?
>>>
>>> SEVERE: Exception during lifecycle processing
>>> org.glassfish.deployment.common.DeploymentException: CDI definition
>>> failure:WELD-000071 Managed bean class
>>> com.sun.enterprise.security.audit.BaseAuditManager must be @Dependent
>>> at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
>>> at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
>>>
>>>
>>> Regards, Tomaz
>>>
>>>
>>>
>>> Dne 22.5.2014 9:58, piše Tomaz Majerhold:
>>>> Whay ProgrammaticLogin not working, I'm trying to port apliactions
>>>> from GF v3.1.2 to GF v4
>>>>
>>>> 1) GF :
>>>> ----------
>>>> Name:
>>>>
>>>> server
>>>> Status:
>>>>
>>>> Running<Mail Attachment.gif>
>>>> JVM:
>>>>
>>>> JVM Report <http://localhost:4848/common/index.jsf#>
>>>> Configuration:
>>>>
>>>> server-config
>>>> <http://localhost:4848/common/configuration/configuration.jsf?configName=server-config>
>>>> Installation Directory:
>>>>
>>>> A:\IDE\glassfish-4.0_NetBeans8\Program Files\glassfish
>>>> Installed Version:
>>>>
>>>> GlassFish Server Open Source Edition 4.0 (build 89)
>>>> Secure Administration:
>>>>
>>>> Not Enabled
>>>> Debug:
>>>>
>>>> Not Enabled
>>>> Up Time:
>>>>
>>>> 34 Minutes 13 Seconds
>>>> HTTP Port(s):
>>>>
>>>> 4848,8080,8181
>>>> IIOP Port(s)
>>>>
>>>> 3820,3920,3700
>>>>
>>>>
>>>> 2) In server.policy I enabled
>>>> // EJB securety
>>>> grant codeBase "file:${com.sun.aas.installRoot}/modules/-" {
>>>> permission com.sun.appserv.security.ProgrammaticLoginPermission
>>>> "login";
>>>> };
>>>>
>>>> // EJB securety
>>>> grant codeBase "file:${com.sun.aas.installRoot}/modules/-" {
>>>> permission com.sun.appserv.security.ProgrammaticLogin
>>>> "login";
>>>> };
>>>>
>>>> in modules directory I have security.jar, security-ee.jar,
>>>> security-ee-l10n.jar, security-l10n.jar, security-services.jar
>>>>
>>>>
>>>> 3) But when I start my web application ProgramaticLogin was NOT in
>>>> classpath(No class, so strange ...)
>>>>
>>>> 4) Ok put dependecy in my web apliaction
>>>> <!-- EJB -->
>>>> <dependency>
>>>> <groupId>org.glassfish.security</groupId>
>>>> <artifactId>security</artifactId>
>>>> <version>3.2-b06</version>
>>>> <type>jar</type>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>javax</groupId>
>>>> <artifactId>javaee-web-api</artifactId>
>>>> <version>7.0</version>
>>>> <scope>provided</scope>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.glassfish</groupId>
>>>> <artifactId>javax.ejb</artifactId>
>>>> <version>3.1.1</version>
>>>> <scope>provided</scope>
>>>> </dependency>
>>>>
>>>> But then I get even stranger error, I coulden find solution on
>>>> internet, the error is:
>>>>
>>>> ava.lang.NoSuchMethodError:
>>>> com.sun.enterprise.security.SecurityServicesUtil.getHabitat()Lorg/jvnet/hk2/component/Habitat;
>>>> at
>>>> com.sun.appserv.security.ProgrammaticLogin.resolveWebProgrammaticLogin(ProgrammaticLogin.java:517)
>>>> at
>>>> com.sun.appserv.security.ProgrammaticLogin.<init>(ProgrammaticLogin.java:116)
>>>> at
>>>> si.arnes.apis.wc.api.EjbLookupConnector.login(EjbLookupConnector.java:44)
>>>>
>>>>
>>>>
>>>> So what I'm doing wrong?
>>>>
>>>> Regards, Tomaž Majerhold
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>