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-ibm
Commits
772e50ab
Commit
772e50ab
authored
Nov 09, 2020
by
Bhushan Rade
Browse files
IBM security code fix
parent
c7b2c889
Pipeline
#14340
passed with stages
in 9 minutes and 41 seconds
Changes
20
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/opengroup/osdu/core/common/model/entitlements/CreateGroup.java
View file @
772e50ab
// Copyright 2017-2019, Schlumberger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.core.common.model.entitlements
;
...
...
src/main/java/org/opengroup/osdu/core/common/model/entitlements/GetMembers.java
View file @
772e50ab
// Copyright 2017-2019, Schlumberger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.core.common.model.entitlements
;
...
...
src/main/java/org/opengroup/osdu/core/common/model/entitlements/GroupInfo.java
View file @
772e50ab
// Copyright 2017-2019, Schlumberger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.core.common.model.entitlements
;
...
...
src/main/java/org/opengroup/osdu/core/common/model/entitlements/MemberInfo.java
View file @
772e50ab
// Copyright 2017-2019, Schlumberger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.core.common.model.entitlements
;
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/EntitlementFactory.java
View file @
772e50ab
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.ibm.entitlements
;
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/EntitlementsApplication.java
View file @
772e50ab
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.ibm.entitlements
;
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/GlobalExceptionMapper.java
View file @
772e50ab
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.ibm.entitlements
;
...
...
@@ -59,12 +73,12 @@ public class GlobalExceptionMapper extends ResponseEntityExceptionHandler {
new
AppException
(
HttpStatus
.
FORBIDDEN
.
value
(),
"Access denied"
,
e
.
getMessage
(),
e
));
}
@ExceptionHandler
(
Exception
.
class
)
protected
ResponseEntity
<
Object
>
handleGeneralException
(
Exception
e
)
{
return
this
.
getErrorResponse
(
new
AppException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
(),
"Server error."
,
"An unknown error has occurred."
,
e
));
}
/*
* @ExceptionHandler(Exception.class) protected ResponseEntity<Object>
* handleGeneralException(Exception e) {
return this.getErrorResponse(
new
*
AppException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Server error.",
*
"An unknown error has occurred.", e));
}
*/
private
ResponseEntity
<
Object
>
getErrorResponse
(
AppException
e
)
{
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/api/EntitlementsApi.java
View file @
772e50ab
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.ibm.entitlements.api
;
...
...
@@ -25,8 +39,10 @@ import org.opengroup.osdu.core.common.model.entitlements.Groups;
import
org.opengroup.osdu.core.common.model.entitlements.MemberInfo
;
import
org.opengroup.osdu.core.common.model.entitlements.Members
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.ibm.entitlements.model.EntitlementsRole
;
import
org.opengroup.osdu.ibm.entitlements.service.EntitlementsIBM
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -46,6 +62,9 @@ public class EntitlementsApi {
@Inject
private
EntitlementsIBM
entitlementsIBM
;
@Autowired
TenantInfo
tenantInfo
;
public
void
setEntitlementsService
(
EntitlementsIBM
entitlementsIBM
)
{
this
.
entitlementsIBM
=
entitlementsIBM
;
...
...
@@ -60,6 +79,7 @@ public class EntitlementsApi {
@PostMapping
(
"/groups"
)
@RolesAllowed
(
EntitlementsRole
.
ROLE_ADMIN
)
public
ResponseEntity
<
GroupInfo
>
postGroup
(
@RequestBody
CreateGroup
newGroup
)
{
tenantInfo
.
getName
();
GroupInfo
groupInfo
=
entitlementsIBM
.
createGroup
(
newGroup
);
return
new
ResponseEntity
<
GroupInfo
>(
groupInfo
,
HttpStatus
.
OK
);
}
...
...
@@ -75,6 +95,7 @@ public class EntitlementsApi {
if
(
Strings
.
isNullOrEmpty
(
limit
))
{
limit
=
"0"
;
}
tenantInfo
.
getName
();
GetMembers
getMembers
=
new
GetMembers
(
cursor
,
Integer
.
parseInt
(
limit
));
return
new
ResponseEntity
<
Members
>(
entitlementsIBM
.
getMembers
(
groupEmail
,
getMembers
),
HttpStatus
.
OK
);
...
...
@@ -85,7 +106,7 @@ public class EntitlementsApi {
public
ResponseEntity
<
MemberInfo
>
postMembers
(
@PathVariable
(
"groupEmail"
)
GroupEmail
groupEmail
,
@RequestBody
MemberInfo
memberInfo
)
{
tenantInfo
.
getName
();
try
{
return
new
ResponseEntity
<
MemberInfo
>(
entitlementsIBM
.
addMember
(
groupEmail
,
memberInfo
),
HttpStatus
.
OK
);
}
catch
(
AppException
e
)
{
...
...
@@ -102,7 +123,8 @@ public class EntitlementsApi {
public
ResponseEntity
<
Void
>
deleteMember
(
@PathVariable
(
"groupEmail"
)
String
groupEmail
,
@PathVariable
(
"memberEmail"
)
String
memberEmail
)
{
tenantInfo
.
getName
();
entitlementsIBM
.
deleteMember
(
groupEmail
,
memberEmail
);
return
new
ResponseEntity
<
Void
>(
HttpStatus
.
NO_CONTENT
);
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/api/HealthCheckApi.java
View file @
772e50ab
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.ibm.entitlements.api
;
import
javax.annotation.security.PermitAll
;
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/api/WhoamiController.java
View file @
772e50ab
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.ibm.entitlements.api
;
import
org.springframework.security.core.Authentication
;
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/di/TenantInfoProvider.java
View file @
772e50ab
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.ibm.entitlements.di
;
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/model/EntitlementsRole.java
View file @
772e50ab
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* begin_generated_IBM_copyright_prolog
*
* *******************************************
* IBM Confidential.
* OCO Source Materials
* 5900-AEB
* © Copyright IBM Corp. 2020
* The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has
* been deposited with the U.S. Copyright Office.
*
* end_generated_IBM_copyright_prolog
*/
package
org.opengroup.osdu.ibm.entitlements.model
;
...
...
src/main/java/org/opengroup/osdu/ibm/entitlements/security/AppKeyValidator.java
View file @
772e50ab
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**