2012-04-25 69 views
1

服務器模式下ravendb的驗證機制是什麼? Authentication包包含用於創建用戶的AuthenticationUser類和用於驗證用戶的AuthenticateClient類。 AuthenticateClient類有一個功能我如何在RavenDB中驗證用戶

public bool Authenticate(DocumentDatabase currentStore, string username, string password, out AccessTokenBody.DatabaseAccess[] allowedDatabases) 

我不知道如何使用這個函數的方式。這個函數需要DocumentDatabase對象。我不知道如何實例化DocumentDatabase對象。有什麼辦法來實現身份驗證?如果你知道的話,請告訴我更好的方法。提前致謝。

回答

0

Rajdeep,你不需要使用這個類,也不需要實例化DocumentDatabase類。這是RavenDB內部的東西。

RavenDB默認使用Windows身份驗證。如果您想要使用OAuth,則這是Authentication Bundle的用途。請看看這裏看看你怎麼可以使用該捆綁:http://ravendb.net/docs/server/bundles/authentication

+0

非常感謝丹尼爾,我遵循相同的方法,但異常發生「遠程服務器返回錯誤:(401)未經授權。」 我該如何解決此錯誤?請幫助 – 2012-04-26 05:37:03

+0

你做了什麼?請張貼代碼 – 2012-04-27 22:54:32