|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jvnet.hudson.client_demo.SecuredMain
public class SecuredMain
Java client program to demonstrate how to access Hudson remote API, when authentication is involved.
http://hudson.gotdns.com/wiki/display/HUDSON/Remote+access+API| Constructor Summary | |
|---|---|
SecuredMain()
|
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
On most security configurations, except "delegate to servlet container" authentication, simply sending in the BASIC authentication pre-emptively works. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SecuredMain()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.io.IOException
However, in the "delegate to servlet container" mode, BASIC auth support depends on the container implementation, and hence inherently unreliable. The following code uses Jakarta Commons HTTP client to work around this problem by essentially emulating what the user does through the browser.
The code first emulates a click of the "login" link, then submit
the login form. Once that's done, you are authenticated, so you
can access the information you wanted. This is all possible
because HttpClient maintains a cookie jar in it.
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||