Commit 5787d9ea authored by Aman Verma's avatar Aman Verma
Browse files

moving interfaces from azure to schema-core

parent a4289eca
Pipeline #62217 passed with stages
in 29 minutes and 48 seconds
// Copyright © Microsoft Corporation
//
// 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.
package org.opengroup.osdu.schema.azure.interfaces;
import org.opengroup.osdu.schema.exceptions.ApplicationException;
import org.opengroup.osdu.schema.exceptions.BadRequestException;
import org.opengroup.osdu.schema.model.SchemaInfo;
import org.opengroup.osdu.schema.model.SchemaRequest;
import org.opengroup.osdu.schema.model.SchemaUpsertResponse;
public interface ISchemaServiceAzure {
/**
* This method creates a shared schema
* @param schemaRequest schema request
* @return Schema info of created schema
* @throws ApplicationException
* @throws BadRequestException
*/
SchemaInfo createSystemSchema(SchemaRequest schemaRequest) throws ApplicationException, BadRequestException;
/**
* This method first tries to update the schema with the given schema-id. If there is no schema found,
* it tries to create the new shared schema.
* @param schemaRequest schema request
* @return schema upsert response
* @throws ApplicationException
* @throws BadRequestException
*/
SchemaUpsertResponse upsertSystemSchema(SchemaRequest schemaRequest) throws ApplicationException, BadRequestException;
}
package org.opengroup.osdu.schema.azure.service.serviceimpl;
import org.opengroup.osdu.schema.azure.interfaces.IAuthorizationServiceForServicePrincipal;
import com.azure.spring.autoconfigure.aad.UserPrincipal;
import org.opengroup.osdu.schema.provider.interfaces.authorization.IAuthorizationServiceForServicePrincipal;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
......
package org.opengroup.osdu.schema.azure.interfaces;
package org.opengroup.osdu.schema.provider.interfaces.authorization;
public interface IAuthorizationServiceForServicePrincipal {
boolean isDomainAdminServiceAccount();
......
package org.opengroup.osdu.schema.azure.auth;
package org.opengroup.osdu.schema.security;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.schema.azure.interfaces.IAuthorizationServiceForServicePrincipal;
import org.opengroup.osdu.schema.provider.interfaces.authorization.IAuthorizationServiceForServicePrincipal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;
......@@ -20,4 +20,5 @@ public class AuthorizationFilterSP {
headers.put(DpsHeaders.USER_EMAIL, "ServicePrincipalUser");
return authorizationService.isDomainAdminServiceAccount();
}
}
......@@ -128,7 +128,7 @@ public class SchemaService implements ISchemaService {
/**
* Method to create schema
*
* @param schema request
* @param schemaRequest request
* @return schemaInfo.
* @throws JSONException
* @throws JsonProcessingException
......@@ -392,7 +392,7 @@ public class SchemaService implements ISchemaService {
public SchemaUpsertResponse upsertSystemSchema(SchemaRequest schemaRequest) throws ApplicationException, BadRequestException {
return this.upsertSchemaInternal(schemaRequest, true);
}
private void getSchemaInfos(QueryParams queryParams, List<SchemaInfo> schemaList, String tenant)
throws ApplicationException {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment