[ovirt-devel] How To Auto Set oVirt RESTApi Session?

王成俊 wcj2007 at gmail.com
Thu Dec 4 02:57:43 UTC 2014


I'm sorry I did not explain my needs clearly.

In my case,I want to redesign the WebAdmin login GUI and add some
javascript in my WebAdmin login page to do many own logic.At present I
don't know how to add javascript in gwt framework,so I have to make a
servlet to alternative the original WebAdmin login GUI.

After admin user log in the WebAdmin Portal through my servlet,UIPlugin
which use restapi to get data in the portal cannot automate get the
user's certificate,the uiplugin show me a prompt to input the username and
password.

I am looking forward to your guide!

        Thanks!

Best regards!


2014-12-03 1:04 GMT+08:00 Vojtech Szocs <vszocs at redhat.com>:

>
>
> ----- Original Message -----
> > From: "Alexander Wels" <awels at redhat.com>
> > To: "王成俊" <wcj2007 at gmail.com>
> > Cc: devel at ovirt.org
> > Sent: Tuesday, December 2, 2014 1:59:21 PM
> > Subject: Re: [ovirt-devel] How To Auto Set oVirt RESTApi Session?
> >
> > On Tuesday, December 02, 2014 09:45:49 AM 王成俊 wrote:
> > > Hi,awels:
> > >
> > >      Thanks for your reply!
> > >
> > >      I make this servlet to run the backend action which
> > > names "LoginAdminUser", because I want to check admin log in with it,so
> > > that my engine no need to log in through engine's loginpopupview.
>
> Hm, so you're trying to automate WebAdmin GUI login? Can you please
> explain your use case without any technical (servlet etc.) details?
>
> > >
> > >      But when I log in through my servlet,the restapi can not get the
> > > user's certificate.
> > >
> > >      Can you tell me how to set and resume the restapi session in my
> case?
> > >
> > >      Thanks!
> > >
> > > Best Regards!
> > >
> >
> > You can login to the REST api using standard http connection techniques.
> For
> > instance basic auth you can login doing the following:
> >
> > http://<user>%40<domain>:<password>@<engine_host>/ovirt-engine/api
> >
> > Will list the available REST api.
> >
> > But I am still not clear on what you are trying to do. Are you trying to
> > write
> > your own external servlet, that calls the REST api to do things for you?
> Or
> > are you trying to write a servlet that lives inside the context of the
> engine
> > and implements a new action?
> >
> > Also please reply all, so we can keep the discussion on the mailing list
> so
> > other people can find it in the future.
> >
> > Alexander
> >
> >
> > > 2014-12-02 5:42 GMT+08:00 Alexander Wels <awels at redhat.com>:
> > > > On Monday, December 01, 2014 04:56:04 PM 王成俊 wrote:
> > > > > Dear Sir:
> > > > >
> > > > >          I am a new one in studing ovirt engine.Now,I have a
> Servlet in
> > > > >
> > > > > org.ovirt.engine.ui.frontend.server.gwt package.
> > > > >
> > > > >          I want to call
> > > > >
> > > > >
> *Frontend.getInstance().getLoginHandler().**onLoginSuccess(userName,
> > > > > password, domain)* to set session for restapi in this servlet.
> > > > >
> > > > >          But when I visit this servlet,it occur to show me an error
> > > > >          which
> > > > >
> > > > > just like "*JBWEB000071: root cause
> java.lang.ClassNotFoundException:
> > > > > org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback from
> [Module
> > > > > &quot;deployment.engine.ear.webadmin.war:main&quot; from Service
> Module
> > > > > Loader]*". I found that this error is occured by calling*
> > > > > Frontend.getInstance()*.
> > > > >
> > > > >          Can you tell me how to resolve this problem or a new way
> to
> > > > >          set
> > > > >
> > > > > and resume restapi session in a servlet package of
> > > > > org.ovirt.engine.ui.front.server.gwt like the
> RestApiSessionManager in
> > > > > org.ovirt.engine.ui.webadmin.plugin.restapi package?
> > > > >
> > > > >            thanks!
> > > > >
> > > > > Best Regards!
> > > >
> > > > Hi,
> > > >
> > > > The problem you are experiencing is the fact the
> Frontend.getInstance()
> > > > is
> > > > a
> > > > frontend (client, which get compiled to javascript) class, and the
> > > > servlet
> > > > is
> > > > on the server side where this class is not defined (as it is frontend
> > > > only).
> > > > Maybe if you could explain what you are trying to do we could assist
> > > > better.
> > > >
> > > > We have a mechanism of getting the REST api session on the front end
> when
> > > > you
> > > > log in. On the backend you don't really need that, since you are on
> the
> > > > backend. So your question sort of confuses me at this point.
> > > >
> > > > Alexander
> >
> > _______________________________________________
> > Devel mailing list
> > Devel at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/devel
>



-- 
*用心体会,生活本来有滋有味!*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20141204/77b0d7ff/attachment-0001.html>


More information about the Devel mailing list