Search in sources :

Example 1 with SchemeType

use of org.thingsboard.server.common.data.oauth2.SchemeType in project thingsboard by thingsboard.

the class OAuth2ServiceImpl method getOAuth2Clients.

@Override
public List<OAuth2ClientInfo> getOAuth2Clients(String domainSchemeStr, String domainName, String pkgName, PlatformType platformType) {
    log.trace("Executing getOAuth2Clients [{}://{}] pkgName=[{}] platformType=[{}]", domainSchemeStr, domainName, pkgName, platformType);
    if (domainSchemeStr == null) {
        throw new IncorrectParameterException(INCORRECT_DOMAIN_SCHEME);
    }
    SchemeType domainScheme;
    try {
        domainScheme = SchemeType.valueOf(domainSchemeStr.toUpperCase());
    } catch (IllegalArgumentException e) {
        throw new IncorrectParameterException(INCORRECT_DOMAIN_SCHEME);
    }
    validateString(domainName, INCORRECT_DOMAIN_NAME + domainName);
    return oauth2RegistrationDao.findEnabledByDomainSchemesDomainNameAndPkgNameAndPlatformType(Arrays.asList(domainScheme, SchemeType.MIXED), domainName, pkgName, platformType).stream().map(OAuth2Utils::toClientInfo).collect(Collectors.toList());
}
Also used : SchemeType(org.thingsboard.server.common.data.oauth2.SchemeType) IncorrectParameterException(org.thingsboard.server.dao.exception.IncorrectParameterException)

Aggregations

SchemeType (org.thingsboard.server.common.data.oauth2.SchemeType)1 IncorrectParameterException (org.thingsboard.server.dao.exception.IncorrectParameterException)1