how to login to jenkins with third party sso from python scripts

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

how to login to jenkins with third party sso from python scripts

Sushant Gupta
Hi All,

I don't know if anyone tried to login to sso enabled jenkins server from python api.

I need to automate jenkins, It is very easy to login to jenkins from python with its local-user/password. But our jenkins server is configured with assembla sso and I am not able to login through jenkins.jenkins python module. Can any oen suggest how to login to jenkins server with third party sso configuration.
python api docs: https://python-jenkins.readthedocs.org/en/latest/api.html

I am open to use any other module.

import jenkins
j = jenkins.Jenkins('http://your_url_here', 'username', 'password')
j.get_jobs()

Regards,
Sushant

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5ac34a0a-56ea-4209-9b7f-9ceee02c5d9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: how to login to jenkins with third party sso from python scripts

Khai Do-2
It looks like Jenkins supports access with an API token[1] .  Unfortunately python-jenkins doesn't provide the ability to pass an API token when connecting to jenkins.  But it does seem like what you are asking for is possible.  I would suggest you enter a bug in the python-jenkins issue tracker for this feature.  You never know :)  

[1] http://blog.cloudbees.com/2011/08/api-token-in-jenkins-rest-api.html


On Wednesday, June 17, 2015 at 12:20:28 AM UTC-7, Sushant Gupta wrote:
Hi All,

I don't know if anyone tried to login to sso enabled jenkins server from python api.

I need to automate jenkins, It is very easy to login to jenkins from python with its local-user/password. But our jenkins server is configured with assembla sso and I am not able to login through jenkins.jenkins python module. Can any oen suggest how to login to jenkins server with third party sso configuration.
python api docs: <a href="https://python-jenkins.readthedocs.org/en/latest/api.html" rel="nofollow" style="color:rgb(12,101,165);font-size:15px" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fpython-jenkins.readthedocs.org%2Fen%2Flatest%2Fapi.html\46sa\75D\46sntz\0751\46usg\75AFQjCNGBmK91B6uU9pW3AwLW1Tsdui2JRw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fpython-jenkins.readthedocs.org%2Fen%2Flatest%2Fapi.html\46sa\75D\46sntz\0751\46usg\75AFQjCNGBmK91B6uU9pW3AwLW1Tsdui2JRw&#39;;return true;">https://python-jenkins.readthedocs.org/en/latest/api.html

I am open to use any other module.

import jenkins
j = jenkins.Jenkins('<a href="http://your_url_here/" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fyour_url_here%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHjxCavHXTfyJOy5p_OmJHbYj2RYA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fyour_url_here%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHjxCavHXTfyJOy5p_OmJHbYj2RYA&#39;;return true;">http://your_url_here', 'username', 'password')
j.get_jobs()

Regards,
Sushant

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/50c3b601-8b52-4b44-876f-b87b87847dff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: how to login to jenkins with third party sso from python scripts

Khai Do-2
Actually I am wrong.  python-jenkins does allow users to pass a token when connecting to jenkins.   You can just pass the username and token to authenticate, just replace the password with the token and it should work, like so..

j = jenkins.Jenkins('http://your_url_here', 'username', '0d571a048e1f707f306cb52a44a5f706')


On Tuesday, July 14, 2015 at 10:24:37 PM UTC-7, Khai Do wrote:
It looks like Jenkins supports access with an API token[1] .  Unfortunately python-jenkins doesn't provide the ability to pass an API token when connecting to jenkins.  But it does seem like what you are asking for is possible.  I would suggest you enter a bug in the python-jenkins issue tracker for this feature.  You never know :)  

[1] <a href="http://blog.cloudbees.com/2011/08/api-token-in-jenkins-rest-api.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fblog.cloudbees.com%2F2011%2F08%2Fapi-token-in-jenkins-rest-api.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFQNDByyJSVRb-dNEo8ewYTjKZPIg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fblog.cloudbees.com%2F2011%2F08%2Fapi-token-in-jenkins-rest-api.html\46sa\75D\46sntz\0751\46usg\75AFQjCNFQNDByyJSVRb-dNEo8ewYTjKZPIg&#39;;return true;">http://blog.cloudbees.com/2011/08/api-token-in-jenkins-rest-api.html


On Wednesday, June 17, 2015 at 12:20:28 AM UTC-7, Sushant Gupta wrote:
Hi All,

I don't know if anyone tried to login to sso enabled jenkins server from python api.

I need to automate jenkins, It is very easy to login to jenkins from python with its local-user/password. But our jenkins server is configured with assembla sso and I am not able to login through jenkins.jenkins python module. Can any oen suggest how to login to jenkins server with third party sso configuration.
python api docs: <a href="https://python-jenkins.readthedocs.org/en/latest/api.html" rel="nofollow" style="color:rgb(12,101,165);font-size:15px" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fpython-jenkins.readthedocs.org%2Fen%2Flatest%2Fapi.html\46sa\75D\46sntz\0751\46usg\75AFQjCNGBmK91B6uU9pW3AwLW1Tsdui2JRw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fpython-jenkins.readthedocs.org%2Fen%2Flatest%2Fapi.html\46sa\75D\46sntz\0751\46usg\75AFQjCNGBmK91B6uU9pW3AwLW1Tsdui2JRw&#39;;return true;">https://python-jenkins.readthedocs.org/en/latest/api.html

I am open to use any other module.

import jenkins
j = jenkins.Jenkins('<a href="http://your_url_here/" style="color:rgb(17,85,204)" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fyour_url_here%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHjxCavHXTfyJOy5p_OmJHbYj2RYA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fyour_url_here%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHjxCavHXTfyJOy5p_OmJHbYj2RYA&#39;;return true;">http://your_url_here', 'username', 'password')
j.get_jobs()

Regards,
Sushant
 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a6428569-d622-40af-a5d8-897665f8c2e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: how to login to jenkins with third party sso from python scripts

Lokeshwaran
In reply to this post by Sushant Gupta
Where do we get this API token from

On Wednesday, June 17, 2015 at 12:50:28 PM UTC+5:30, Sushant Gupta wrote:
Hi All,

I don't know if anyone tried to login to sso enabled jenkins server from python api.

I need to automate jenkins, It is very easy to login to jenkins from python with its local-user/password. But our jenkins server is configured with assembla sso and I am not able to login through jenkins.jenkins python module. Can any oen suggest how to login to jenkins server with third party sso configuration.
python api docs: <a href="https://python-jenkins.readthedocs.org/en/latest/api.html" rel="nofollow" style="color:rgb(12,101,165);font-size:15px" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fpython-jenkins.readthedocs.org%2Fen%2Flatest%2Fapi.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGBmK91B6uU9pW3AwLW1Tsdui2JRw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fpython-jenkins.readthedocs.org%2Fen%2Flatest%2Fapi.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGBmK91B6uU9pW3AwLW1Tsdui2JRw&#39;;return true;">https://python-jenkins.readthedocs.org/en/latest/api.html

I am open to use any other module.

import jenkins
j = jenkins.Jenkins('<a href="http://your_url_here/" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fyour_url_here%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjxCavHXTfyJOy5p_OmJHbYj2RYA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fyour_url_here%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjxCavHXTfyJOy5p_OmJHbYj2RYA&#39;;return true;">http://your_url_here', 'username', 'password')
j.get_jobs()

Regards,
Sushant

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2e41317c-832c-460b-9bbd-4220dc850b60o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: how to login to jenkins with third party sso from python scripts

Richard Bywater-3

On Wed, 24 Jun 2020 at 16:53, Lokeshwaran <[hidden email]> wrote:
Where do we get this API token from

On Wednesday, June 17, 2015 at 12:50:28 PM UTC+5:30, Sushant Gupta wrote:
Hi All,

I don't know if anyone tried to login to sso enabled jenkins server from python api.

I need to automate jenkins, It is very easy to login to jenkins from python with its local-user/password. But our jenkins server is configured with assembla sso and I am not able to login through jenkins.jenkins python module. Can any oen suggest how to login to jenkins server with third party sso configuration.
python api docs: https://python-jenkins.readthedocs.org/en/latest/api.html

I am open to use any other module.

import jenkins
j = jenkins.Jenkins('http://your_url_here', 'username', 'password')
j.get_jobs()

Regards,
Sushant

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2e41317c-832c-460b-9bbd-4220dc850b60o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAAy0hwe%3DjSh%2BZD_86NE7dgOWqTvdDD8GVm%3DqAv_wpwondLwkpQ%40mail.gmail.com.