Custom Glassfish Security Realm does not work (unable to find LoginModule)

前端 未结 2 1118

I\'m trying to get a Custom Security Realm in Glassfish working (i tried 3.0.1 final and 3.1 B33). I read nearly all tutorials about this, but it doesn\'t not work on my Sys

2条回答
  •  盖世英雄少女心
    2020-12-16 05:14

    Got it. Seems like newer Glassfish versions require that the Security Realm and the LoginModule are packaged as an OSGi module, which should then be copied into glassfish/modules.

    Therefore i changed my pom.xml to create an OSGi bundle, which contains both the CustomRealm and the CustomLoginModule.

    Here it is:

    
        4.0.0
    
        com.mycompany
        security.realm
        1.0-SNAPSHOT
        bundle
    
        Custom JDBCRealm OSGi
        http://maven.apache.org
    
        
            UTF-8
        
    
        
            
                org.glassfish.security
                security
                3.1-b33
            
        
    
        
            
                
                    org.apache.maven.plugins
                    maven-compiler-plugin
                    
                        1.6
                        1.6
                        true
                        true
                        UTF-8
                    
                
                
                    org.apache.felix
                    maven-bundle-plugin
                    true
                    
                        
                            
                                ${project.groupId}.${project.artifactId};version=${project.version}
                            
                            
                                com.sun.appserv.security,
                                org.glassfish.security.common,
                                com.sun.enterprise.security.auth.realm,
                                com.sun.enterprise.security.auth.login.common,
                                java.util,
                                javax.security.auth
                            
                        
                    
                
            
        
    
    

    EDIT

    Found a good additional resource here: http://blogs.oracle.com/nithya/entry/modularized_osgi_custom_realms_in , where the Realm and it's LoginModule is build as a hk2-jar.

提交回复
热议问题