Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Security and Compliance
entitlements-azure
Commits
6a08eca9
Commit
6a08eca9
authored
Jul 15, 2020
by
Daniel Scholl
Browse files
Merge branch 'master' into 'fix-context-path-entitlement'
# Conflicts: # devops/development-pipeline.yml
parents
d828676b
4173a41b
Pipeline
#3445
passed with stages
in 45 minutes and 54 seconds
Changes
4
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
6a08eca9
...
...
@@ -170,6 +170,8 @@ The following table lists the properties that are required when you create a use
##### Response
If successful, this method returns 201 response code and user object in the response body.
If the user profile already exists, this method returns a 409 response code and an error message in the response body.
##### Example: Create a user
##### Request
...
...
integration-tests/src/test/java/org/opengroup/osdu/azure/entitlements/acceptanceTests/EntitlementsApiTests.java
View file @
6a08eca9
...
...
@@ -381,15 +381,6 @@ public class EntitlementsApiTests {
assertEquals
(
HttpStatus
.
SC_BAD_REQUEST
,
response
.
getStatus
());
}
@Test
public
void
givenValidIntegrationTesterAndUserInfoExists_whenCallCreateProfile_thenBadRequest
()
throws
Exception
{
String
path
=
"profile"
;
String
json
=
TestUserInfoData
.
getJsonFromTestFile
(
"test_userinfo_OneTenantItem"
);
ClientResponse
response
=
TestUtils
.
send
(
path
,
"POST"
,
TestUtils
.
getHeaders
(),
json
,
""
);
assertEquals
(
HttpStatus
.
SC_BAD_REQUEST
,
response
.
getStatus
());
}
@Test
public
void
givenAnonymous_whenCallDeleteProfile_thenForbidden
()
throws
Exception
{
String
path
=
"profile/"
+
TEST_REGULAR_USER_ID
;
...
...
@@ -538,7 +529,7 @@ public class EntitlementsApiTests {
}
@Test
public
void
givenValidIntegrationTesterAndServicePrincipalExists_whenCallCreateProfile_then
BadReques
t
()
throws
Exception
{
public
void
givenValidIntegrationTesterAndServicePrincipalExists_whenCallCreateProfile_then
Conflic
t
()
throws
Exception
{
String
path
=
"profile"
;
if
(
isSetupEnabled
())
{
setUp
(
TEST_SP_ID
,
TestType
.
DELETE
);
...
...
@@ -548,7 +539,7 @@ public class EntitlementsApiTests {
ClientResponse
response
=
TestUtils
.
send
(
path
,
"POST"
,
TestUtils
.
getHeaders
(),
json
,
""
);
assertEquals
(
HttpStatus
.
SC_
BAD_REQUES
T
,
response
.
getStatus
());
assertEquals
(
HttpStatus
.
SC_
CONFLIC
T
,
response
.
getStatus
());
if
(
isTeardownEnabled
())
{
tearDown
(
TEST_SP_ID
,
TestType
.
DELETE
);
...
...
src/main/java/org/opengroup/osdu/azure/entitlements/service/EntitlementsAzure.java
View file @
6a08eca9
...
...
@@ -51,6 +51,7 @@ public class EntitlementsAzure
private
static
final
String
SC_BAD_REQUEST_REASON
=
"bad request"
;
private
static
final
String
SC_NOT_FOUND_REASON
=
"not found"
;
private
static
final
String
SC_FORBIDDEN_REASON
=
"forbidden"
;
private
static
final
String
SC_CONFLICT_REASON
=
"resource already existed"
;
protected
enum
UserType
{
REGULAR_USER
,
...
...
@@ -316,7 +317,7 @@ public class EntitlementsAzure
userInfoRepository
.
create
(
userInfoDoc
);
return
userInfoDoc
;
}
else
throw
new
AppException
(
HttpStatus
.
SC_
BAD_REQUEST
,
SC_BAD_REQUES
T_REASON
,
String
.
format
(
"user profile already exists for '%s'"
,
userInfoDoc
.
getUid
()));
throw
new
AppException
(
HttpStatus
.
SC_
CONFLICT
,
SC_CONFLIC
T_REASON
,
String
.
format
(
"user profile already exists for '%s'"
,
userInfoDoc
.
getUid
()));
}
/**
...
...
src/test/java/org/opengroup/osdu/azure/entitlements/EntitlementsAzureTests.java
View file @
6a08eca9
...
...
@@ -206,7 +206,7 @@ public class EntitlementsAzureTests {
}
@Test
public
void
givenServicePrincipalInJwtAndProfileExists_whenCreateProfile_then
BadReques
t
()
{
public
void
givenServicePrincipalInJwtAndProfileExists_whenCreateProfile_then
Conflic
t
()
{
setField
(
sut
,
TestUtils
.
SERVICE_DOMAIN_NAME
,
TestUtils
.
getDomain
());
//serviceprincipal in JWT
createAADUserPrincipalSetSecurityContext
(
TestUtils
.
APPID
,
TestUtils
.
getAppId
(),
TestUtils
.
OID
,
TestUtils
.
getOid
());
...
...
@@ -222,7 +222,7 @@ public class EntitlementsAzureTests {
sut
.
createUserInfo
(
userInfoDoc
);
}
catch
(
AppException
ae
)
{
assertEquals
(
HttpStatus
.
SC_
BAD_REQUES
T
,
ae
.
getError
().
getCode
());
assertEquals
(
HttpStatus
.
SC_
CONFLIC
T
,
ae
.
getError
().
getCode
());
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment