meclipse icon indicating copy to clipboard operation
meclipse copied to clipboard

Auth support

Open philnate opened this issue 12 years ago • 10 comments

Allow to connect to Mongo Instances running with auth enabled.

philnate avatar Apr 25 '12 13:04 philnate

+1

bigal488 avatar May 09 '12 13:05 bigal488

Commits regarding this feature will be pushed to authentication branch until feature is stable and ready to be merged back. Please feel free to test and report problems.

philnate avatar May 22 '12 14:05 philnate

Would love to test, but I must be being dim: I can't figure out how to install a Meclipse branch into Aptana Studio. When I download the branch as a zip, unzip and then point Aptana's Install New Software to the local folder, I get a "cannot find the file:/xxxx/FlaPer87-meclipse-20f4f34/" error. Same if I use any of the subdirectories. Any pointers?

bigal488 avatar May 22 '12 15:05 bigal488

Include the Project into your eclipse, then right-click root and click export->Plugin-Development->deployable Plugins and Fragments. Select the MongoDB Plugin if not already selected. Now choose your eclipse Directory (/home/USERNAME/eclipse). At the tab Options activate the checkbox Qualifier Replacement and set something you like, so you avoid to potentially multiple versions which could cause problems or require more update actions. Now you can click finish, after a Restart you should be running the checked out version.

Note that I didn't commited anything to this branch related to authentication actually.

philnate avatar May 23 '12 07:05 philnate

Thanks. I made some progress but the export process fails: /Users/al/Documents/Aptana Studio 3 Workspace/Meclipse/build.xml:177: srcdir "/Users/al/Documents/Aptana Studio 3 Workspace/Meclipse/output.. = target/classes" does not exist! ...Sorry if I'm missing something obvious.

bigal488 avatar May 23 '12 08:05 bigal488

I've made recently some changes to both branches (develop and authentication) as there were some errors present, please update to latest.

philnate avatar May 23 '12 10:05 philnate

OK. Thats allowed it to install. Now when I try to open the Meclipse/MongoDB View, I first get a "Unknown Host: 192.168.0.112" (this is where my mongodb instance is running). This setting must be left from the previous Meclipse install. I cannot view properties for this item: I get "Could not create the view: An unexpected exception was thrown." error

If I then open the New Connection window, I see the Name,Host and port fields with an "Auth Not Supported Yet" message??? I double checked that I uninstalled previous Meclipse and that I defeintely had the Authentication branch.

bigal488 avatar May 23 '12 10:05 bigal488

As told earlier I didn't worked on authentication yet. The old connection entry is a left over from your previous install but shouldn't do any harm. Can you paste the exact stack trace? You can see it by clicking on the expand(or more) button. Is this instance Running with authentication enabled?

philnate avatar May 23 '12 10:05 philnate

Yes, my instance has auth enabled. I'm connected to it from the same machine with MongoHub, so I know its working. If the dialog doesn't allow the entry of the auth credentials, how do I enter them to test? Stack Trace:


java.lang.NullPointerException
    at org.mongodb.meclipse.views.objects.Connection.getServerStatus(Connection.java:127)
    at org.mongodb.meclipse.views.objects.properties.ConnectionPropertySource.<init>(ConnectionPropertySource.java:10)
    at org.mongodb.meclipse.views.objects.Connection.getAdapter(Connection.java:139)
    at org.eclipse.ui.internal.views.ViewsPlugin.getAdapter(ViewsPlugin.java:103)
    at org.eclipse.ui.views.properties.PropertySheetEntry.getPropertySource(PropertySheetEntry.java:472)
    at org.eclipse.ui.views.properties.PropertySheetEntry.setValues(PropertySheetEntry.java:752)
    at org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:973)
    at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:510)
    at org.eclipse.ui.views.properties.PropertySheet.partActivated(PropertySheet.java:336)
    at org.eclipse.ui.part.PageBookView.showBootstrapPart(PageBookView.java:920)
    at org.eclipse.ui.part.PageBookView.createPartControl(PageBookView.java:491)
    at org.eclipse.ui.views.properties.PropertySheet.createPartControl(PropertySheet.java:157)
    at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
    at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2245)
    at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1145)
    at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3921)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3918)
    at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3894)
    at org.mongodb.meclipse.views.objects.TreeObject$2.run(TreeObject.java:45)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4128)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3974)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3613)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at com.aptana.rcp.IDEApplication.start(IDEApplication.java:125)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

bigal488 avatar May 23 '12 10:05 bigal488

So with the last commit related to the ticket it's possible to authenticate as admin against a given Database. I'm somewhat unsure how we should handle authentication for single dbs only. From what I encountered it's not possible to listDatabases as soon as -auth is used, and we're not authenticated against admin database. So we can't simply display all dbs and ask for username/password where needed.

So my basic idea on this is to change the display of the given connection, allowing to add user/pw for admin afterwards for this connection. Additionally we could add an option to add login credentials database wise so we could display only those where we have credentials for.

What do you think about this approach?

philnate avatar Jun 14 '12 13:06 philnate