Browse Source

Added required methods to OAuth2Service

pull/3557/head
vzikratyi 6 years ago
parent
commit
a6eefa903e
  1. 31
      common/dao-api/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2Service.java
  2. 48
      dao/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2ServiceImpl.java

31
common/dao-api/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2Service.java

@ -1,12 +1,12 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
*
* <p>
* 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
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
@ -15,6 +15,9 @@
*/
package org.thingsboard.server.dao.oauth2;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.oauth2.OAuth2ClientInfo;
import org.thingsboard.server.common.data.oauth2.OAuth2ClientRegistration;
@ -24,4 +27,24 @@ public interface OAuth2Service {
OAuth2ClientRegistration getClientRegistration(String registrationId);
List<OAuth2ClientInfo> getOAuth2Clients();
List<OAuth2ClientRegistration> getSystemOAuth2ClientRegistrations(TenantId tenantId);
List<OAuth2ClientRegistration> getTenantOAuth2ClientRegistrations(TenantId tenantId);
List<OAuth2ClientRegistration> getCustomerOAuth2ClientRegistrations(TenantId tenantId, CustomerId customerId);
OAuth2ClientRegistration saveSystemOAuth2ClientRegistration(OAuth2ClientRegistration clientRegistration);
OAuth2ClientRegistration saveTenantOAuth2ClientRegistration(TenantId tenantId, OAuth2ClientRegistration clientRegistration);
OAuth2ClientRegistration saveCustomerOAuth2ClientRegistration(TenantId tenantId, CustomerId customerId, OAuth2ClientRegistration clientRegistration);
void deleteDomainOAuth2ClientRegistrationByEntityId(TenantId tenantId, EntityId entityId);
boolean isOAuth2ClientRegistrationAllowed(TenantId tenantId, EntityId entityId);
boolean isCustomerOAuth2ClientRegistrationAllowed(TenantId tenantId);
}

48
dao/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2ServiceImpl.java

@ -18,6 +18,9 @@ package org.thingsboard.server.dao.oauth2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.oauth2.*;
import java.util.Collections;
@ -52,6 +55,51 @@ public class OAuth2ServiceImpl implements OAuth2Service {
return startUpConfiguration.collect(Collectors.toList());
}
@Override
public List<OAuth2ClientRegistration> getSystemOAuth2ClientRegistrations(TenantId tenantId) {
return null;
}
@Override
public List<OAuth2ClientRegistration> getTenantOAuth2ClientRegistrations(TenantId tenantId) {
return null;
}
@Override
public List<OAuth2ClientRegistration> getCustomerOAuth2ClientRegistrations(TenantId tenantId, CustomerId customerId) {
return null;
}
@Override
public OAuth2ClientRegistration saveSystemOAuth2ClientRegistration(OAuth2ClientRegistration clientRegistration) {
return null;
}
@Override
public OAuth2ClientRegistration saveTenantOAuth2ClientRegistration(TenantId tenantId, OAuth2ClientRegistration clientRegistration) {
return null;
}
@Override
public OAuth2ClientRegistration saveCustomerOAuth2ClientRegistration(TenantId tenantId, CustomerId customerId, OAuth2ClientRegistration clientRegistration) {
return null;
}
@Override
public void deleteDomainOAuth2ClientRegistrationByEntityId(TenantId tenantId, EntityId entityId) {
}
@Override
public boolean isOAuth2ClientRegistrationAllowed(TenantId tenantId, EntityId entityId) {
return false;
}
@Override
public boolean isCustomerOAuth2ClientRegistrationAllowed(TenantId tenantId) {
return false;
}
@Override
public OAuth2ClientRegistration getClientRegistration(String registrationId) {
if (oauth2Configuration == null || !oauth2Configuration.isEnabled()) return null;

Loading…
Cancel
Save