首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Neo4j 2.2、密码和ROR错误- UsersController#try_login中的未授权错误

Neo4j 2.2、密码和ROR错误- UsersController#try_login中的未授权错误
EN

Stack Overflow用户
提问于 2015-03-26 09:44:45
回答 2查看 375关注 0票数 0

刚刚从2.1升级到2.2..系统提示您将密码添加到neo4j。是不是..。图形看起来很好..但是现在我的rails应用程序,它使用了新的Gem,将不能连接。

我得到了这个错误:

UsersController#try_login中的未授权错误

我已将代码更改为

代码语言:javascript
复制
@neo = Neography::Rest.new("http://neo4j:neo4j!@localhost:7474")

但它不起作用。

已将初始化文件更改为

代码语言:javascript
复制
Neography.configure do |config|
  config.protocol       = "http://"
  config.server         = "localhost"
  config.port           = 7474
  config.directory      = ""  # prefix this path with '/' 
  config.cypher_path    = "/cypher"
  config.gremlin_path   = "/ext/GremlinPlugin/graphdb/execute_script"
  config.log_file       = "neography.log"
  config.log_enabled    = false
  config.max_threads    = 20
  config.authentication = nil  # nil 'basic' or 'digest'
  config.username       = "neo4j"
  config.password       = "neo4j!"
  config.parser         = MultiJsonParser
end

这也不起作用(不用担心密码被更改了)

以前我从来没有在Neo上使用过密码,但在这个新版本中,我使用了密码,现在我的应用程序无法连接。我没有安装任何证书,并且正在使用任何形式的身份验证。

我可以在登录后使用正确的密码连接到web管理员,但我无法通过我的应用程序成功连接。

有什么我没注意到的吗?我需要安装证书吗?在OS 10.7.5、Rails 3.2.11、Ruby ruby 1.9.3p429、webrick和Neography Gem上工作。

更新:我是从rails控制台运行的:

代码语言:javascript
复制
@neo = Neography::Rest.new("http://neo4j:neo4j@localhost:7474")

然后回来了

代码语言:javascript
复制
=> #<Neography::Rest:0x007fe04a8ff9d0 @connection=#<Neography::Connection:0x007fe04a8ff7f0 @protocol="http://", @server="localhost", @port=7474, @directory="", @cypher_path="/cypher", @gremlin_path="/ext/GremlinPlugin/graphdb/execute_script", @log_file="neography.log", @log_enabled=false, @max_threads=20, @parser=MultiJsonParser, @user_agent={"User-Agent"=>"Neography/1.0.9"}, @authentication={:basic_auth=>{:username=>"neo4j", :password=>"neo4j"}}, @client=#<HTTPClient:0x007fe04a906640 @proxy=nil, @no_proxy=nil, @no_proxy_regexps=[], @www_auth=#<HTTPClient::WWWAuth:0x007fe04a906438 @basic_auth=#<HTTPClient::BasicAuth:0x007fe04a906410 @cred=nil, @set=false, @auth={}, @challengeable={}, @scheme="Basic">, @digest_auth=#<HTTPClient::DigestAuth:0x007fe04a906118 @auth={}, @challenge={}, @set=false, @nonce_count=0, @scheme="Digest">, @negotiate_auth=#<HTTPClient::NegotiateAuth:0x007fe04a906050 @auth={}, @auth_default=nil, @challenge={}, @scheme="Negotiate", @set=false, @ntlm_opt={:ntlmv2=>true}>, @ntlm_auth=#<HTTPClient::NegotiateAuth:0x007fe04a905f38 @auth={}, @auth_default=nil, @challenge={}, @scheme="NTLM", @set=false, @ntlm_opt={:ntlmv2=>true}>, @sspi_negotiate_auth=#<HTTPClient::SSPINegotiateAuth:0x007fe04a905e48 @challenge={}, @scheme="Negotiate">, @oauth=#<HTTPClient::OAuth:0x007fe04a905d80 @config=nil, @auth={}, @challengeable={}, @nonce_count=0, @signature_handler={"HMAC-SHA1"=>#<Method: HTTPClient::OAuth#sign_hmac_sha1>}, @scheme="OAuth">, @authenticator=[#<HTTPClient::OAuth:0x007fe04a905d80 @config=nil, @auth={}, @challengeable={}

然后我尝试创建一个节点:

代码语言:javascript
复制
@neo.create_node

并接收到

代码语言:javascript
复制
Neography::UnauthorizedError:  from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/bundler/gems/neography-589bd7b680ac/lib/neography/connection.rb:181:in `handle_4xx_500_response'
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/bundler/gems/neography-589bd7b680ac/lib/neography/connection.rb:143:in `return_result'
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/bundler/gems/neography-589bd7b680ac/lib/neography/connection.rb:126:in `evaluate_response'
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/bundler/gems/neography-589bd7b680ac/lib/neography/connection.rb:45:in `post'
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/bundler/gems/neography-589bd7b680ac/lib/neography/rest/nodes.rb:48:in `create_empty'
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/bundler/gems/neography-589bd7b680ac/lib/neography/rest/nodes.rb:35:in `create'
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/bundler/gems/neography-589bd7b680ac/lib/neography/rest.rb:81:in `create_node'
from (irb):2
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /Volumes/Data/BlueFrog/BigData/n2/neograph/vendor/bundle/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
EN

回答 2

Stack Overflow用户

发布于 2015-03-26 11:02:46

很奇怪..。这对我很有效。

代码语言:javascript
复制
2.2.0 :003 > @neo = Neography::Rest.new("http://neo4j:swordfish@localhost:7474")

@neo.create_node

{"extensions"=>{}, "outgoing_relationships"=>"http://localhost:7474/db/data/node/0/relationships/out", "labels"=>"http://localhost:7474/db/data/node/0/labels", "traverse"=>"http://localhost:7474/db/data/node/0/traverse/{returnType}", "all_typed_relationships"=>"http://localhost:7474/db/data/node/0/relationships/all/{-list|&|types}", "self"=>"http://localhost:7474/db/data/node/0", "property"=>"http://localhost:7474/db/data/node/0/properties/{key}", "properties"=>"http://localhost:7474/db/data/node/0/properties", "outgoing_typed_relationships"=>"http://localhost:7474/db/data/node/0/relationships/out/{-list|&|types}", "incoming_relationships"=>"http://localhost:7474/db/data/node/0/relationships/in", "create_relationship"=>"http://localhost:7474/db/data/node/0/relationships", "paged_traverse"=>"http://localhost:7474/db/data/node/0/paged/traverse/{returnType}{?pageSize,leaseTime}", "all_relationships"=>"http://localhost:7474/db/data/node/0/relationships/all", "incoming_typed_relationships"=>"http://localhost:7474/db/data/node/0/relationships/in/{-list|&|types}", "metadata"=>{"id"=>0, "labels"=>[]}, "data"=>{}} 

你能确认你的代码中没有"Neography::Rest.new“吗?

票数 0
EN

Stack Overflow用户

发布于 2015-07-30 21:01:37

您可以允许在不进行身份验证的情况下进行访问(尽管这当然不太安全)。

变化

代码语言:javascript
复制
dbms.security.auth_enabled=true

代码语言:javascript
复制
dbms.security.auth_enabled=false

在文件中

代码语言:javascript
复制
conf/neo4j-server.properties
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29269714

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档