#gooddata-csharp
There are two basic classes
- SSOProvider.cs
- ApiWrapper.cs
##SSOProvider ####The SSOProvider has two dependencies:
- gpg4win http://www.gpg4win.org/
- starksoftopenpg library, http://sourceforge.net/projects/starksoftopenpg/. The ddl included in this project is a modified version of 1.0.40. My modification fixes the Sign method to respect the armor attribute which is required for integration with gooddata
####To get the code running you'll need to:
- Install gpg4win http://www.gpg4win.org/download.html (Note: Install the program to C:\Program Files\GnuPG)
- Configure IIS *(Note: In IIS 7+ this will only work under the ApplicationPoolIdentity with the Load User Profile flag set to true)
- Setup your keys
To setup keys (Note: replace 'yourcompany.com' and [path] with approproate values)
- Open cmd prompt
- Run: "gpg --version" to verify the installation.
- Run: "gpg --import [path]\gooddata-sso.pub" to import the gooddata public key. NOTE: Replace [path]. Keys are located in this project or can be found here, http://developer.gooddata.com/docs/gooddata-sso.pub
- Run: "gpg --import [path]\gooddata-sso-testing.pub" to import the gooddata testing public key.
To generate a new public and private key
- Run: "gpg --gen-key" and follow the command prompts. Use something like [email protected] as the email address. DONT FORGET YOUR PASSPHRASE
- Run: "gpg --output C:[path]\gooddata_yourcompany.pub --export [email protected]"
- Run: "gpg --output C:[path]\gooddata_yourcompany_private.key --export-secret-key [email protected]"
Using either a preexisting key or the key you just create
- Run: "gpg --import C:\gooddata_yourcompany.pub" to import your company's public key.
- Run: "gpg --allow-secret-key-import --import C:\gooddata_yourcompany_private.key" to import your company's public key.
Verify key setup
- Run: "gpg --list-keys" This should return 3 entries: 1) [email protected] 2) [email protected] 3) [email protected]
- Run: "gpg --armor -u [email protected] --output test_userdata_signed.txt --sign [path]\test_userdata.txt" Note: A sample file can be found in this project
- Run: "gpg --armor --output test_userdata_encrypted.txt --encrypt --recipient [email protected] test_userdata.txt"
- Run: "gpg --output test_userdata_decrypted.txt --decrypt test_userdata_encrypted.txt"
After importing the keys you'll need to copy the key rings from your user account (C:\Users[you]\AppData\Roaming\gnupg) to "C:\gnupg".
####To run the tests: You'll need to set the recipient, email and passphrase in the wen.config to get the tests to work.
Reference instructions:
http://quantumlab.net/pine_privacy_guard/howto_setup_gpg.html
http://developer.gooddata.com/docs/sso
###Sample GPG Commands
Sign: gpg --armor -u [email protected] --output test_userdata_signed.txt --sign test_userdata.txt
Encrypt: gpg --armor --output test_userdata_encrypted.txt --encrypt --recipient [email protected] test_userdata.txt
Sign & Encrypt: gpg --armor --output test_userdata_encryptedsigned.txt --recipient [email protected] --encrypt --sign test_userdata.txt
Decrypt: gpg --output test_userdata_decrypted.txt --decrypt test_userdata_encrypted.txt
##ApiWrapper Currently only contains methods for:
- Authenticate
- User
- Project
- Some meta