Select to view content in your preferred language

Portalpy question on a Portal that uses AD credentials for login.

3483
11
04-12-2016 11:32 AM
SharonMeier
Deactivated User

I have written a script to create a csv list of users on my Portal.  Trying to create some scripts to automate some tasks to move users from one portal to another.    My script works fine on my test server and generates the list of users as a csv file.   However, when I try to use this script on one of my production portals I am getting an error indicating that I am not authorized.   This particular server/portal is setup to use CAC authentication and Active Directory accounts.   CAC is our Common Access Cards and contains certificates that we use to authenticate to our network.   So, my question is, how do I access my portal through Python/PortalPy when it is set to use AD accounts?  

"""

portalUrl           = "https://portal.url.."

portalAdminUser     = "AdminUser"

portalAdminPassword = "AdminPassword"

defaultFilename='Map4_portal_users.csv'

   

portal = portalpy.Portal(portalUrl, portalAdminUser, portalAdminPassword)

0 Kudos
11 Replies
NeilAyres
MVP Alum

Is "AdminUser" a user in that portal? ie not coming from AD.

0 Kudos
SharonMeier
Deactivated User

Yes, AdminUser is a user in the portal, not coming in from AD.

0 Kudos
NeilAyres
MVP Alum

Well, and AdminUser has administrative rights...

Ie its got nothing to do with AD.

What I do is then use portalpy to get_org_users, then cycle through all their content.

0 Kudos
SharonMeier
Deactivated User

Yes, AdminUser has administrative rights in Portal.    I'm not able to get to portalpy functions such as get_org_users because I don't get past the line in the script where it tries to connect to the portal  - portal = portalpy.Portal(portalUrl, portalAdminUser, portalAdminPassword).    That is the line where it errors out.

0 Kudos
NeilAyres
MVP Alum

So, what's the error? Have you checked using the normal portal home page that you can sign in using this user?

0 Kudos
SharonMeier
Deactivated User

Error is HTTP 403:   Forbidden.  

When I try to go to the normal portal page it is configured to prompt for our CAC credentials and does not let me enter a username/password combination.    My AD account also has administrative rights, but with our CAC credentials we no longer have a password, so I can't use that in my script.   I somehow got to a login screen and was able to log in with AdminUser, so I have tested the password and know I can log in with it.

0 Kudos
NeilAyres
MVP Alum

Shouldn't you be accessing portal through https:....

0 Kudos
SharonMeier
Deactivated User

Yes, I should, and my url is https.   Below is the messages I get when I run my script.

0 Kudos
SharonMeier
Deactivated User

I guess my question should be modified to be "how do I use portalpy to connect to my portal when my portal uses PKI authentication"?

0 Kudos