2738 Commits

Author SHA1 Message Date
dandds
b81ece7ad9
Merge branch 'staging' into azure-user-creation 2020-02-03 13:54:22 -05:00
dandds
bb7cbf00cd Add microsoft domain to AAD user names. 2020-02-03 11:17:42 -05:00
dandds
0517bd1b0a Fix task order uploads.
Task order uploads and downloads were broken. Uploads were broken
because file content was eing read in as plaintext every time, resulting
in encoding issues. I updated the bundle to use the newer Azure JS SDK.
We can now use a method for uploading browser files directly without
having to read their content. This required a few small internal changes
to the upload component, since the response structure is different.

I also removed the `downloadUrl` method from the JS uploader since it
was not being used.

Downloads were broken because the method that generates the download
link was not updated to use the BlobSasPermissions class from the
updated Azure Python SDK.
2020-02-03 09:56:02 -05:00
dandds
0b8886182d Fix wrong creds reference in create_applications method. 2020-02-02 14:42:44 -05:00
dandds
6b8d9d1d65 Celery wrapper for creating a user. 2020-02-02 14:42:44 -05:00
dandds
b1c6dd5ad0 Adds a method for creating an Active Directory user.
This method is added to the Azure cloud interface. We need to set the
AAD user's alternate email, which is a subsequent PATCH call to the API.
These two calls are handled with a single interface method and payload
because ATAT would never create a user without an associated email.

This commit also:

- Expands internal method for getting principal tokens so that it can be
  scoped to different resources.
- Retains the tenant domain name in the portfolios.csp_data column
  because ATAT needs that information for provisioning users via API.
2020-02-02 14:42:44 -05:00
dandds
cc28f53999 Function for claiming multiple resources at once.
Like claim_for_update, the claim_many_for_update claims resources with
an expiring lock. This was written to allow the updating of multiple
application roles with a single cloud_id, since multiple application
roles will map to a single Azure Active Directory user.
2020-02-02 14:19:13 -05:00
dandds
1b45502fe5 SQLAlchemy query for finding ApplicationRoles ready for provisioning.
This adds a query method to return the IDs of the application roles that
should be provisioned as users in Azure. We will provision one Azure
Active Directory user per ATAT user in a portfolio, meaning that one AAD
user might correspond to multiple application roles under a single
portfolio. The query method returns IDs in a nested list grouped by
portfolio and user because of this.

add method for getting app roles that are pending creation

update application_roles query to group by portfolio

check for user existing and role status correct when filtering ApplicationRole for creation
2020-02-02 14:03:17 -05:00
dandds
4511630787 Update application_roles table for provisioning.
Adds cloud_id and claimed_until columns to the application_roles table
so that rows can be locked when they're being processed and updated with
relevant Azure information when processing is finished. Since the
claimed_until column is now common to a few different models, I've also
moved it to a mixin.
2020-02-02 14:01:35 -05:00
tomdds
61e891258b Merge branch 'staging' into azure-subscriptions 2020-01-31 17:00:43 -05:00
tomdds
6952a533e2
Merge branch 'staging' into product-purchase-provisioning 2020-01-31 15:50:31 -05:00
tomdds
bbed83d897 Update AADP Purchase url and respose format to newer schema. 2020-01-31 15:50:10 -05:00
tomdds
53dcb94046
Merge branch 'staging' into azure-subscriptions 2020-01-31 15:43:08 -05:00
tomdds
d5e739ea68 Fill in subscription creation mocks 2020-01-31 14:42:38 -05:00
tomdds
9acbeeb824 Add display name to subscription creation payload
Also extracts environment -> subscription payload construction to it's own method.
2020-01-31 14:42:38 -05:00
tomdds
670e135a0e
Merge branch 'staging' into azure-subscriptions 2020-01-31 14:41:39 -05:00
tomdds
a0ea3e3220
Merge branch 'staging' into product-purchase-provisioning 2020-01-31 14:41:32 -05:00
leigh-mil
42b3fa2b0c
Merge branch 'staging' into download-and-email-tos 2020-01-31 14:28:37 -05:00
tomdds
e672941259 Source correct tenant id for root credentials 2020-01-31 14:11:28 -05:00
leigh-mil
b5e7ea3fa6 Fix column type on portfolios defense_component 2020-01-31 14:03:30 -05:00
graham-dds
e32e211966 Make Upload related classes more generic
Renames Python classes that refer to Upload to something to FileService.
We added this change because these classes now handle downloading as
well as uploading.
2020-01-31 13:17:00 -05:00
graham-dds
a7770d8a6a Add method to download TOs from Azure 2020-01-31 13:17:00 -05:00
graham-dds
00a5a98577 Add Mailer class method to email TOs to MSFT 2020-01-31 13:17:00 -05:00
tomdds
ba84b92795
Merge branch 'staging' into product-purchase-provisioning 2020-01-31 13:13:07 -05:00
leigh-mil
745ce713b0 Hard code TO upload description into the UploadInput Macro
This is a temporary fix to avoid spending too much time trying to use app.config variables in a Form class field descriptions and labels. This is tech debt and should be fixed in the future.
2020-01-31 12:08:48 -05:00
tomdds
f41d54aa9e
Merge branch 'staging' into product-purchase-provisioning 2020-01-31 12:03:08 -05:00
leigh-mil
0c408bccfd Update PDF file size limit to be less than the GMail SMTP size limit 2020-01-31 11:59:07 -05:00
leigh-mil
dff9924c95 Make file size limit configurable 2020-01-31 11:59:07 -05:00
tomdds
73ddd32365 Only unpack AADP purchase date after verifying response code. 2020-01-31 11:51:13 -05:00
dandds
10f8bf9503 Fix bug in setting Secure on session cookie.
This fixes a bug I introduced with commit

6edc7b138b0745d0b3f9d99da76c445fe954c5a7

The value for SESSION_COOKIE_SECURE was being read in as a truthy string
every time. In order for it to be interpreted correctly, we need to map
it to a boolean.
2020-01-31 06:18:54 -05:00
tomdds
6b8ea41925 Make AADP purchase quantity configurable
Also remove a few constant params from the payload model.
2020-01-30 22:12:28 -05:00
29b69a7d5d code formatting 2020-01-30 16:50:32 -05:00
tomdds
afcc4d16cd Add functionality for creating and verifying subscriptions.
Currently the create call will be consumed by on-demand requests from the frontend, and the 2 stage create will be used by the enviroment management group provisioning to verify an initial subscription was created.
2020-01-30 15:58:09 -05:00
7e4340e7e4 resolve merge conflict with staging 2020-01-30 15:57:06 -05:00
de992eeed8 premium product purchase code formatting. 2020-01-30 14:50:16 -05:00
7493b9c3d6 premium product purchase unit tests. 2020-01-30 14:48:16 -05:00
leigh-mil
0a7541ef99 Remove unused mock csp routes, templates, and images. Remove unused JEDIhierarchy image 2020-01-30 14:09:12 -05:00
tomdds
6480060b8d
Merge branch 'staging' into azure-admin-provisioning 2020-01-30 11:17:33 -05:00
graham-dds
05ef9131dd
Merge branch 'staging' into safe_redirect 2020-01-30 10:42:33 -05:00
tomdds
33c6e8c68c Merge CSP secret handling implementations and refine updating. 2020-01-29 18:22:21 -05:00
tomdds
0bc0e15134 Merge branch 'staging' into azure-config-values 2020-01-29 16:50:44 -05:00
tomdds
d4dd581b7a Implement principal creation and admin elevation provisioning features. 2020-01-29 16:17:28 -05:00
leigh-mil
f48404215a
Merge branch 'staging' into to-builder-previous-button 2020-01-29 15:09:27 -05:00
graham-dds
82ef8f3574 Add fn to ensure a url matches an app url pattern
In some functions, we redirect a user based on a parameter in a query
string.  This commit adds a function that checks to see if a given url
matches a url pattern of a view function. This will help us ensure that
the url passed  as the next parameter isn't malicious.
2020-01-29 13:24:12 -05:00
5223fda8f8 product purchase mock function correct args 2020-01-29 12:51:33 -05:00
a0d59aa9e4 portfolio provisioning. create product purchase and verification stages 2020-01-29 12:51:19 -05:00
dandds
63b5ddbdd4 Merge branch 'staging' into app-env-provisioning 2020-01-29 11:16:55 -05:00
dandds
abd03be806 Store and pull tenant creds from Key Vault.
The tenant ID should be hashed and used as the key for the JSON blob of
relevant creds for any given tenant. Azure CSP interface methods that
need to source creds should call the internal `_source_creds` method,
either with a `tenant_id` or no parameters. That method will source the
creds. If a tenant ID is provided, it will source them from the Key
Vault. If not provided, it will return the default creds for the app
registration in the home tenant.
2020-01-29 10:49:27 -05:00
tomdds
144312863c Draft implementations of remote admin creation and root management group ownership. 2020-01-28 20:14:50 -05:00
dandds
66bd81eda9
Merge branch 'staging' into take3 2020-01-28 14:33:05 -05:00