2016-03-21 20 views
0

İstemci-cert yetkisiyle birlikte bir özel giriş (gerçekten özel bir uygulamaya ihtiyacım var) modülünü çalıştırmam gerekiyor, ancak modülün kendisi hiçbir zaman çalıştırılamaz. Aynı yaklaşım JBoss üzerinde çalışıyordu 6.wildfly İstemci-cert yetkisiz 10 özel giriş modülü yürütme

Benim özel modülü:

public class WsLoginModule implements LoginModule { 

@Override 
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, 
     Map<String, ?> options) { 
    System.out.println("initialize()"); 
} 

@Override 
public boolean login() throws LoginException { 
    System.out.println("login()"); 
    return true; 
} 

@Override 
public boolean commit() throws LoginException { 
    System.out.println("commit()"); 
    return true; 
} 

@Override 
public boolean abort() throws LoginException { 
    System.out.println("abort()"); 
    return true; 
} 

@Override 
public boolean logout() throws LoginException { 
    System.out.println("logout()"); 
    return true; 
} 

} 

web.xml

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
version="3.1"> 
<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>action</web-resource-name> 
     <description>constraint</description> 
     <url-pattern>/*</url-pattern> 
     <http-method>HEAD</http-method> 
     <http-method>GET</http-method> 
     <http-method>POST</http-method> 
     <http-method>PUT</http-method> 
     <http-method>DELETE</http-method> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>myapp</role-name> 
    </auth-constraint> 
    <user-data-constraint> 
     <description>no description</description> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 
<login-config> 
    <auth-method>CLIENT-CERT</auth-method> 
    <realm-name>custom-security-domain</realm-name> 
</login-config> 
<security-role> 
    <description></description> 
    <role-name>myapp</role-name> 
</security-role> 

jboss-web.xml

<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee 
http://www.jboss.org/j2ee/schema/jboss-web_6_0.xsd" version="6.0"> 
<security-domain>custom-security-domain</security-domain> 

standalone.xml günü, ssl sertifika yapılandırma dahil: Hatta varsayılan güvenlik alanlı değişti

  <security-domain name="custom-security-domain" cache-type="default"> 
       <authentication> 
        <login-module code="my.app.WsLoginModule" flag="required"/> 
       </authentication> 
      </security-domain> 

da

 <security-realm name="SslRealm"> 
      <server-identities> 
       <ssl> 
        <keystore path="/home/me/keystore.javaks" keystore-password="passwd"/> 
       </ssl> 
      </server-identities> 
     </security-realm> 

, standalone.xml benim özel güvenlik-domain

<default-security-domain value="custom-security-domain"/> 

ve son olarak, https dinleyici

<https-listener name="default-ssl" security-realm="SslRealm" socket-binding="https"/> 

Yukarıda gösterildiği gibi her şey iyi görünüyor, ancak daha sonra bir web servisini çağırmak gibi basit görevleri yürütmeye çalışırken yalnızca "Yasak" alıyorum (bir sertifika sunarken bile). Buradaki garip şey, "WsLoginModule" sınıfımın asla idam edilmemesi.

Bir şey mi eksik?

cevap

0

Oturum açma modülünün kodunu bir JBoss modülüne koyun. Bunun nasıl yapılacağına dair belgeleri takip edin, veritabanı JDBC sürücüleri için birçok örnek var.