Skip to content

Commit

Permalink
Fix documentation for force password change endpoint
Browse files Browse the repository at this point in the history
[#132023123] (https://www.pivotaltracker.com/story/show/132023123)

Signed-off-by: Bharath Sekar <bharath.sekar@ge.com>
  • Loading branch information
medvedzver authored and jeaniejung committed Nov 10, 2016
1 parent d7d12c6 commit 6f71930
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 8 deletions.
@@ -1,5 +1,8 @@
package org.cloudfoundry.identity.uaa.account; package org.cloudfoundry.identity.uaa.account;


import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserAccountStatus { public class UserAccountStatus {


private Boolean locked; private Boolean locked;
Expand Down
49 changes: 42 additions & 7 deletions uaa/slate/source/index.md.erb
Expand Up @@ -1409,25 +1409,25 @@ uaac password change -o secret -p newsecret
Added in UAA 3.7.0 Added in UAA 3.7.0
</aside> </aside>


<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_unlock_user/curl-request.md")).result(binding) %> <%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_unlock_user/curl-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_unlock_user/http-request.md")).result(binding) %> <%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_unlock_user/http-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_unlock_user/http-response.md")).result(binding) %> <%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_unlock_user/http-response.md")).result(binding) %>


_Path Parameters_ _Path Parameters_


<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_unlock_user/path-parameters.md")).result(binding) %> <%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_unlock_user/path-parameters.md")).result(binding) %>


_Request Headers_ _Request Headers_


<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_unlock_user/request-headers.md")).result(binding) %> <%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_unlock_user/request-headers.md")).result(binding) %>


_Request Fields_ _Request Fields_


<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_unlock_user/request-fields.md")).result(binding) %> <%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_unlock_user/request-fields.md")).result(binding) %>


_Response Fields_ _Response Fields_


<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_unlock_user/response-fields.md")).result(binding) %> <%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_unlock_user/response-fields.md")).result(binding) %>


_Error Codes_ _Error Codes_


Expand All @@ -1438,6 +1438,41 @@ _Error Codes_
| 403 | Forbidden - Insufficient scope (scim.write or uaa.account_status.write) | | 403 | Forbidden - Insufficient scope (scim.write or uaa.account_status.write) |
| 404 | User id not found | | 404 | User id not found |


## Force user password to expire

<aside class="success">
Added in UAA 3.9.0
</aside>

<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_password_expire_user/curl-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_password_expire_user/http-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_password_expire_user/http-response.md")).result(binding) %>

_Path Parameters_

<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_password_expire_user/path-parameters.md")).result(binding) %>

_Request Headers_

<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_password_expire_user/request-headers.md")).result(binding) %>

_Request Fields_

<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_password_expire_user/request-fields.md")).result(binding) %>

_Response Fields_

<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/test_status_password_expire_user/response-fields.md")).result(binding) %>

_Error Codes_

| Error Code | Description |
|------------|------------------------------------------------------------------------------------------------------------|
| 400 | Bad Request - invalid JSON format or illegal value |
| 401 | Unauthorized - Invalid token |
| 403 | Forbidden - Insufficient scope (scim.write or uaa.account_status.write) |
| 404 | User id not found

## Get user verification link ## Get user verification link


<%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/getUserVerificationLink/curl-request.md")).result(binding) %> <%= ERB.new(File.read("../build/generated-snippets/ScimUserEndpointDocs/getUserVerificationLink/curl-request.md")).result(binding) %>
Expand Down
Expand Up @@ -403,7 +403,7 @@ public void test_Create_User() throws Exception {
} }


@Test @Test
public void test_unlock_user() throws Exception {UserAccountStatus alteredAccountStatus = new UserAccountStatus(); public void test_status_unlock_user() throws Exception {UserAccountStatus alteredAccountStatus = new UserAccountStatus();
alteredAccountStatus.setLocked(false); alteredAccountStatus.setLocked(false);
String jsonStatus = JsonUtils.writeValueAsString(alteredAccountStatus); String jsonStatus = JsonUtils.writeValueAsString(alteredAccountStatus);


Expand Down Expand Up @@ -433,6 +433,37 @@ public void test_Create_User() throws Exception {
); );
} }


@Test
public void test_status_password_expire_user() throws Exception {UserAccountStatus alteredAccountStatus = new UserAccountStatus();
alteredAccountStatus.setPasswordExpires(true);
String jsonStatus = JsonUtils.writeValueAsString(alteredAccountStatus);

getMockMvc()
.perform(
RestDocumentationRequestBuilders.patch("/Users/{userId}/status", user.getId())
.header("Authorization", "Bearer " + scimWriteToken)
.accept(APPLICATION_JSON)
.contentType(APPLICATION_JSON)
.content(jsonStatus)
)
.andExpect(status().isOk())
.andExpect(content().json(jsonStatus))
.andDo(
document("{ClassName}/{methodName}",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()),
pathParameters(parameterWithName("userId").description(userIdDescription)),
requestHeaders(
headerWithName("Authorization").description("Access token with scim.write, uaa.account_status.write, or uaa.admin required"),
IDENTITY_ZONE_ID_HEADER,
IDENTITY_ZONE_SUBDOMAIN_HEADER
),
requestFields(fieldWithPath("passwordExpires").optional(null).description("Set to `true` in order to force user’s password to expire").type(BOOLEAN)),
responseFields(fieldWithPath("passwordExpires").description("The `passwordExpires` value given in the request.").type(BOOLEAN))
)
);
}

@Test @Test
public void test_Update_User() throws Exception { public void test_Update_User() throws Exception {
ApprovalStore store = getWebApplicationContext().getBean(ApprovalStore.class); ApprovalStore store = getWebApplicationContext().getBean(ApprovalStore.class);
Expand Down

0 comments on commit 6f71930

Please sign in to comment.