Advertisement
Guest User

Untitled

a guest
Jan 28th, 2016
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.35 KB | None | 0 0
  1. ...
  2. 2016-01-28 14:22:37,028 TRACE [org.jboss.security] (default task-5) PBOX00236: Begin initialize method
  3. 2016-01-28 14:22:37,028 DEBUG [org.jboss.security] (default task-5) PBOX00281: Password hashing activated, algorithm: SHA-256, encoding: base64, charset: null, callback: null, storeCallBack: null
  4. 2016-01-28 14:22:37,028 TRACE [org.jboss.security] (default task-5) PBOX00262: Module options [dsJndiName: java:/PostgresHibrid, principalsQuery: select passwd from users where username=?, rolesQuery: select role, 'Roles' from userroles where username=?, suspendResume: true]
  5. 2016-01-28 14:22:37,029 TRACE [org.jboss.security] (default task-5) PBOX00240: Begin login method
  6. 2016-01-28 14:22:37,030 TRACE [org.jboss.security] (default task-5) PBOX00263: Executing query select passwd from users where username=? with username user0
  7. 2016-01-28 14:22:37,037 TRACE [org.jboss.security] (default task-5) PBOX00244: Begin abort method, overall result: false
  8. 2016-01-28 14:22:37,037 DEBUG [org.jboss.security] (default task-5) PBOX00206: Login failure: javax.security.auth.login.LoginException: PBOX00065: Error processing query
  9. at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:202)
  10. at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:265)
  11. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  12. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  13. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  14. at java.lang.reflect.Method.invoke(Method.java:498)
  15. at javax.security.auth.login.LoginContext.invoke(LoginContext.java:755)
  16. at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
  17. at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
  18. at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
  19. at java.security.AccessController.doPrivileged(Native Method)
  20. at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
  21. at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
  22. at org.jboss.security.authentication.JBossCachedAuthenticationManager.defaultLogin(JBossCachedAuthenticationManager.java:406)
  23. at org.jboss.security.authentication.JBossCachedAuthenticationManager.proceedWithJaasLogin(JBossCachedAuthenticationManager.java:345)
  24. at org.jboss.security.authentication.JBossCachedAuthenticationManager.authenticate(JBossCachedAuthenticationManager.java:333)
  25. at org.jboss.security.authentication.JBossCachedAuthenticationManager.isValid(JBossCachedAuthenticationManager.java:146)
  26. at org.wildfly.extension.undertow.security.JAASIdentityManagerImpl.verifyCredential(JAASIdentityManagerImpl.java:111)
  27. at org.wildfly.extension.undertow.security.JAASIdentityManagerImpl.verify(JAASIdentityManagerImpl.java:82)
  28. at io.undertow.security.impl.FormAuthenticationMechanism.runFormAuth(FormAuthenticationMechanism.java:124)
  29. at io.undertow.security.impl.FormAuthenticationMechanism.authenticate(FormAuthenticationMechanism.java:96)
  30. at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:339)
  31. at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:356)
  32. at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.access$100(SecurityContextImpl.java:325)
  33. at io.undertow.security.impl.SecurityContextImpl.attemptAuthentication(SecurityContextImpl.java:138)
  34. at io.undertow.security.impl.SecurityContextImpl.authTransition(SecurityContextImpl.java:113)
  35. at io.undertow.security.impl.SecurityContextImpl.authenticate(SecurityContextImpl.java:106)
  36. at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:55)
  37. at io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
  38. at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  39. at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)
  40. at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
  41. at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
  42. at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)
  43. at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
  44. at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
  45. at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
  46. at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
  47. at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  48. at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
  49. at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  50. at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  51. at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
  52. at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
  53. at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
  54. at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
  55. at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
  56. at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
  57. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  58. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  59. at java.lang.Thread.run(Thread.java:745)
  60. Caused by: org.postgresql.util.PSQLException: ERROR: relation "users" does not exist
  61. Position: 20
  62. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182)
  63. at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911)
  64. at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173)
  65. at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:622)
  66. at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:472)
  67. at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:386)
  68. at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
  69. at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:185)
  70. ... 50 more
  71.  
  72. 2016-01-28 14:22:37,038 TRACE [org.jboss.security] (default task-5) PBOX00201: End isValid, result = false
  73. 2016-01-28 14:22:37,040 TRACE [org.jboss.security] (default task-5) PBOX00354: Setting security roles ThreadLocal: null ...
  74.  
  75. postgres=# create user hibrid with password 'hibrid';
  76. postgres=# alter role hibrid with createdb;
  77. postgres=# du
  78. List of roles
  79. Role name | Attributes | Member of
  80. -----------+------------------------------------------------+-----------
  81. hibrid | Create DB | {}
  82. postgres | Superuser, Create role, Create DB, Replication | {}
  83.  
  84. postgres=# create database hibrid owner hibrid;
  85. postgres=# l
  86. List of databases
  87. Name | Owner | Encoding | Collate | Ctype | Access privileges
  88. -----------+----------+----------+-------------+-------------+-----------------------
  89. hibrid | hibrid | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
  90.  
  91. hibrid=> c hibrid
  92. hibrid=> CREATE TABLE users(username VARCHAR(255) PRIMARY KEY, passwd VARCHAR(255));
  93. hibrid=> CREATE TABLE userroles(username VARCHAR(255), role VARCHAR(32));
  94. hibrid=> d
  95. List of relations
  96. Schema | Name | Type | Owner
  97. --------+-----------+-------+--------
  98. public | userroles | table | hibrid
  99. public | users | table | hibrid
  100. (2 rows)
  101.  
  102. hibrid=> INSERT INTO users (username, passwd) values ('user0', 'Eu9N7XpGSO2ujqTCad1XT9U4qGhfDFNvLz9+53qpSaM=');
  103. hibrid=> select * from users;
  104. username | passwd
  105. ----------+----------------------------------------------
  106. user0 | Eu9N7XpGSO2ujqTCad1XT9U4qGhfDFNvLz9+53qpSaM=
  107. (1 row)
  108.  
  109. hibrid=> INSERT INTO userroles (username, role) values ('user0', 'ADMIN');
  110. hibrid=> select * from userroles;
  111. username | role
  112. ----------+-------
  113. user0 | ADMIN
  114. (1 row)
  115.  
  116. % ./jboss-cli.sh
  117. [... /] connect
  118.  
  119. [... /] module add --name=org.postgres --resources=/home/hibrid/bin/postgresql-9.4.1207.jar --dependencies=javax.api,javax.transaction.api
  120.  
  121. [... /] /subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver)
  122. {"outcome" => "success"}
  123.  
  124. <subsystem xmlns="urn:jboss:domain:datasources:3.0">
  125. <datasources>
  126. <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
  127. <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
  128. <driver>h2</driver>
  129. <security>
  130. <user-name>sa</user-name>
  131. <password>sa</password>
  132. </security>
  133. </datasource>
  134. <datasource jndi-name="java:/PostgresHibrid" pool-name="PostgresHibrid" enabled="true">
  135. <connection-url>jdbc:postgresql://localhost/postgres</connection-url>
  136. <driver>postgres</driver>
  137. <security>
  138. <user-name>hibrid</user-name>
  139. <password>hibrid</password>
  140. </security>
  141. </datasource>
  142. <drivers>
  143. <driver name="h2" module="com.h2database.h2">
  144. <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
  145. </driver>
  146. <driver name="postgres" module="org.postgres">
  147. <driver-class>org.postgresql.Driver</driver-class>
  148. </driver>
  149. </drivers>
  150. </datasources>
  151. </subsystem>
  152.  
  153. <?xml version="1.0" encoding="UTF-8"?>
  154. <web-app version="3.1" 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">
  155. <context-param>
  156. <param-name>javax.faces.PROJECT_STAGE</param-name>
  157. <param-value>Development</param-value>
  158. </context-param>
  159. <servlet>
  160. <servlet-name>Faces Servlet</servlet-name>
  161. <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  162. <load-on-startup>1</load-on-startup>
  163. </servlet>
  164. <servlet-mapping>
  165. <servlet-name>Faces Servlet</servlet-name>
  166. <url-pattern>/faces/*</url-pattern>
  167. </servlet-mapping>
  168. <session-config>
  169. <session-timeout>
  170. 30
  171. </session-timeout>
  172. </session-config>
  173. <welcome-file-list>
  174. <welcome-file>faces/index.xhtml</welcome-file>
  175. </welcome-file-list>
  176. <security-constraint>
  177. <web-resource-collection>
  178. <web-resource-name>HtmlAuth</web-resource-name>
  179. <description>application security constraints </description>
  180. <url-pattern>/*</url-pattern>
  181. <http-method>GET</http-method>
  182. <http-method>POST</http-method>
  183. <http-method>PUT</http-method>
  184. <http-method>DELETE</http-method>
  185. </web-resource-collection>
  186. <auth-constraint>
  187. <role-name>ADMIN</role-name>
  188. </auth-constraint>
  189. </security-constraint>
  190. <login-config>
  191. <auth-method>FORM</auth-method>
  192. <form-login-config>
  193. <form-login-page>/login.xhtml</form-login-page>
  194. <form-error-page>/error.xhtml</form-error-page>
  195. </form-login-config>
  196. </login-config>
  197. <security-role>
  198. <role-name>ADMIN</role-name>
  199. </security-role>
  200. </web-app>
  201.  
  202. <?xml version="1.0" encoding="UTF-8"?>
  203. <jboss-web>
  204. <security-domain>hibridDomain</security-domain>
  205. </jboss-web>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement