2016-12-12 5 views
0

나는 내가 찾을 수있는 모든 것을 시도했으며이를 해결하지 못했습니다. 내가 사용하여 내 웹 사이트에 FORM 인증을 사용하도록 시도하고 제이 보스 - web.xml의 : 여기 wildfly 보안 도메인이 작동하지 않습니다.

<jboss-web> 
    <context-root>/JacobHewitt</context-root> 
    <security-domain>ref</security-domain> 
</jboss-web> 

내 standalone.xml 여기

<security-domain name="ref" cache-type="default"> 
       <authentication> 
        <login-module code="Database" flag="required"> 
         <module-option name="dsJndiName" value="java:jboss/datasources/RefereeDS"/> 
         <module-option name="principalsQuery" value="SELECT password FROM UserEntity WHERE email=?"/> 
         <module-option name="rolesQuery" value="SELECT role, 'Roles' FROM UserEntity WHERE email=?"/> 
         <module-option name="hashAlgorithm" value="SHA-256"/> 
         <module-option name="hashEncoding" value="base64"/> 
         <module-option name="unauthenticatedIdentity" value="GUEST"/> 
        </login-module> 
       </authentication> 
      </security-domain> 

내 보안 도메인입니다은 데이터 소스입니다 또한 standalone.xml에서

<datasource jta="false" jndi-name="java:jboss/datasources/RefereeDS" pool-name="RefereeDS" enabled="true" use-java-context="true" use-ccm="false"> 
       <connection-url>jdbc:derby://localhost:1527/Referee</connection-url> 
       <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class> 
       <driver>derbyclient.jar</driver> 
       <security> 
         <user-name>jake</user-name> 
         <password>jake</password> 
       </security> 
       <validation> 
         <validate-on-match>false</validate-on-match> 
         <background-validation>false</background-validation> 
       </validation> 
       <statement> 
         <share-prepared-statements>false</share-prepared-statements> 
       </statement> 
      </datasource> 

위의 데이터 소스는 내가 사용해온 것처럼 작동합니다.

여기 UserEntity 테이블을 만드는 데 사용되는 UserEntity.java 클래스가 있습니다. 어떤 도움이 격렬하게 이해할 수있을 것이다

Deploying C:\wildfly-10.1.0.Final\standalone\deployments\JacobHewitt-1.0-SNAPSHOT.war 
"{ 
    <b>\"WFLYCTL0412: Required services that are not installed:\" => [\"jboss.security.security-domain.ref\"],</b> 
    \"WFLYCTL0180: Services with missing/unavailable dependencies\" => [ 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.TeamEJB.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.UserEntityFacade.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.TeamEntityFacade.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.UserEJB.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.undertow.deployment.default-server.default-host./JacobHewitt.UndertowDeploymentInfoService is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.PenaltyCodeEJB.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.RefereeEJB.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.FoulEntityFacade.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.CommentEJB.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.MatchEJB.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.RefereeEntityFacade.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.MatchEntityFacade.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.PenaltyCodeEntityFacade.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.PersonFacade.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.DataBasePopulator.CREATE is missing [jboss.security.security-domain.ref]\", 
     \"jboss.deployment.unit.\\\"JacobHewitt-1.0-SNAPSHOT.war\\\".component.CommentEntityFacade.CREATE is missing [jboss.security.security-domain.ref]\" 
    ] 
}" 

: 여기

/* 
* To change this license header, choose License Headers in Project Properties. 
* To change this template file, choose Tools | Templates 
* and open the template in the editor. 
*/ 
package com.mycompany.jacobhewitt.entitys; 

import java.io.Serializable; 
import java.util.Date; 
import javax.persistence.CascadeType; 
import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.FetchType; 
import javax.persistence.GeneratedValue; 
import javax.persistence.GenerationType; 
import javax.persistence.Id; 
import javax.persistence.NamedQuery; 
import javax.persistence.OneToOne; 
import javax.persistence.Table; 
import javax.persistence.Temporal; 
import javax.persistence.TemporalType; 
import java.io.Serializable; 
import java.math.BigInteger; 
import java.nio.ByteBuffer; 
import java.nio.CharBuffer; 
import java.nio.charset.Charset; 
import java.security.MessageDigest; 
import java.security.NoSuchAlgorithmException; 
import javax.persistence.NamedQueries; 

/** 
* 
* @author jake 
*/ 
@Entity 
@NamedQueries({@NamedQuery(name="findUserByEmail", query="SELECT u FROM UserEntity u WHERE u.email = :email")}) 
public class UserEntity implements Serializable { 

    @Id 
    @Column(name="email") 
    private String email; 

    @Column(name="password", length=32, columnDefinition = "VARCHAR(32)") 
    private char[] password; 

    private String firstName; 
    private String lastName; 

    @Column(name="since", columnDefinition = "DATE", nullable = true) 
    private Date since; 


    private String role; 

    public void setRole(String role){ 
     this.role = role; 

    } 

    public String getRole(){ 
     return role; 
    } 

    public void setPassword(char[] password){ 
     this.password = password; 
    } 

    public void setPassword(String password){ 
     this.password = hashPassword(password.toCharArray()); 
    } 

    public char[] getPassword(){ 
     return password; 
    } 

    public String getFirstName() { 
     return firstName; 
    } 

    public void setFirstName(String firstName) { 
     this.firstName = firstName; 
    } 

    public String getLastName() { 
     return lastName; 
    } 

    public void setLastName(String lastName) { 
     this.lastName = lastName; 
    } 

    public String getEmail() { 
     return email; 
    } 

    public void setEmail(String email) { 
     this.email = email; 
    } 

    public Date getSince() { 
     return since; 
    } 

    public void setSince(Date since) { 
     this.since = since; 
    } 

    private char[] hashPassword(char[] password) { 
     char[] encoded = null; 
     try { 
      ByteBuffer passwdBuffer = Charset.defaultCharset().encode(CharBuffer.wrap(password)); 
      byte[] passwdBytes = passwdBuffer.array(); 
      MessageDigest mdEnc = MessageDigest.getInstance("MD5"); 
      mdEnc.update(passwdBytes, 0, password.length); 
      encoded = new BigInteger(1, mdEnc.digest()).toString(16).toCharArray(); 
     } catch (NoSuchAlgorithmException ex) { 

     } 

     return encoded; 
    } 

} 

내가 제이보스 서버에서 실행하려고 할 때 주어진 오류입니다. 감사합니다

답변

0

시도 내가 아무 소용이 시도했다

<jboss-web> 
    <context-root>/JacobHewitt</context-root> 
    <security-domain>java:/jaas/ref</security-domain> 
</jboss-web> 
+0

의 jboss-web.xml 파일을 업데이트합니다. 어쨌든 고마워. –

관련 문제