Search in sources :

Example 1 with OAuth2ParamsId

use of org.thingsboard.server.common.data.id.OAuth2ParamsId in project thingsboard by thingsboard.

the class OAuth2MobileEntity method toData.

@Override
public OAuth2Mobile toData() {
    OAuth2Mobile mobile = new OAuth2Mobile();
    mobile.setId(new OAuth2MobileId(id));
    mobile.setCreatedTime(createdTime);
    mobile.setOauth2ParamsId(new OAuth2ParamsId(oauth2ParamsId));
    mobile.setPkgName(pkgName);
    mobile.setAppSecret(appSecret);
    return mobile;
}
Also used : OAuth2ParamsId(org.thingsboard.server.common.data.id.OAuth2ParamsId) OAuth2MobileId(org.thingsboard.server.common.data.id.OAuth2MobileId) OAuth2Mobile(org.thingsboard.server.common.data.oauth2.OAuth2Mobile)

Example 2 with OAuth2ParamsId

use of org.thingsboard.server.common.data.id.OAuth2ParamsId in project thingsboard by thingsboard.

the class OAuth2RegistrationEntity method toData.

@Override
public OAuth2Registration toData() {
    OAuth2Registration registration = new OAuth2Registration();
    registration.setId(new OAuth2RegistrationId(id));
    registration.setCreatedTime(createdTime);
    registration.setOauth2ParamsId(new OAuth2ParamsId(oauth2ParamsId));
    registration.setAdditionalInfo(additionalInfo);
    registration.setMapperConfig(OAuth2MapperConfig.builder().allowUserCreation(allowUserCreation).activateUser(activateUser).type(type).basic((type == MapperType.BASIC || type == MapperType.GITHUB || type == MapperType.APPLE) ? OAuth2BasicMapperConfig.builder().emailAttributeKey(emailAttributeKey).firstNameAttributeKey(firstNameAttributeKey).lastNameAttributeKey(lastNameAttributeKey).tenantNameStrategy(tenantNameStrategy).tenantNamePattern(tenantNamePattern).customerNamePattern(customerNamePattern).defaultDashboardName(defaultDashboardName).alwaysFullScreen(alwaysFullScreen).build() : null).custom(type == MapperType.CUSTOM ? OAuth2CustomMapperConfig.builder().url(url).username(username).password(password).sendToken(sendToken).build() : null).build());
    registration.setClientId(clientId);
    registration.setClientSecret(clientSecret);
    registration.setAuthorizationUri(authorizationUri);
    registration.setAccessTokenUri(tokenUri);
    registration.setScope(Arrays.asList(scope.split(",")));
    registration.setPlatforms(StringUtils.isNotEmpty(platforms) ? Arrays.stream(platforms.split(",")).map(str -> PlatformType.valueOf(str)).collect(Collectors.toList()) : Collections.emptyList());
    registration.setUserInfoUri(userInfoUri);
    registration.setUserNameAttributeName(userNameAttributeName);
    registration.setJwkSetUri(jwkSetUri);
    registration.setClientAuthenticationMethod(clientAuthenticationMethod);
    registration.setLoginButtonLabel(loginButtonLabel);
    registration.setLoginButtonIcon(loginButtonIcon);
    return registration;
}
Also used : JsonStringType(org.thingsboard.server.dao.util.mapping.JsonStringType) Arrays(java.util.Arrays) BaseSqlEntity(org.thingsboard.server.dao.model.BaseSqlEntity) OAuth2RegistrationId(org.thingsboard.server.common.data.id.OAuth2RegistrationId) OAuth2BasicMapperConfig(org.thingsboard.server.common.data.oauth2.OAuth2BasicMapperConfig) EnumType(javax.persistence.EnumType) Table(javax.persistence.Table) Enumerated(javax.persistence.Enumerated) JsonNode(com.fasterxml.jackson.databind.JsonNode) PlatformType(org.thingsboard.server.common.data.oauth2.PlatformType) StringUtils(io.micrometer.core.instrument.util.StringUtils) TenantNameStrategyType(org.thingsboard.server.common.data.oauth2.TenantNameStrategyType) Entity(javax.persistence.Entity) OAuth2CustomMapperConfig(org.thingsboard.server.common.data.oauth2.OAuth2CustomMapperConfig) MapperType(org.thingsboard.server.common.data.oauth2.MapperType) UUID(java.util.UUID) EqualsAndHashCode(lombok.EqualsAndHashCode) Type(org.hibernate.annotations.Type) Collectors(java.util.stream.Collectors) OAuth2ParamsId(org.thingsboard.server.common.data.id.OAuth2ParamsId) Column(javax.persistence.Column) OAuth2MapperConfig(org.thingsboard.server.common.data.oauth2.OAuth2MapperConfig) Data(lombok.Data) TypeDef(org.hibernate.annotations.TypeDef) OAuth2Registration(org.thingsboard.server.common.data.oauth2.OAuth2Registration) Collections(java.util.Collections) ModelConstants(org.thingsboard.server.dao.model.ModelConstants) OAuth2ParamsId(org.thingsboard.server.common.data.id.OAuth2ParamsId) OAuth2RegistrationId(org.thingsboard.server.common.data.id.OAuth2RegistrationId) OAuth2Registration(org.thingsboard.server.common.data.oauth2.OAuth2Registration)

Example 3 with OAuth2ParamsId

use of org.thingsboard.server.common.data.id.OAuth2ParamsId in project thingsboard by thingsboard.

the class OAuth2DomainEntity method toData.

@Override
public OAuth2Domain toData() {
    OAuth2Domain domain = new OAuth2Domain();
    domain.setId(new OAuth2DomainId(id));
    domain.setCreatedTime(createdTime);
    domain.setOauth2ParamsId(new OAuth2ParamsId(oauth2ParamsId));
    domain.setDomainName(domainName);
    domain.setDomainScheme(domainScheme);
    return domain;
}
Also used : OAuth2ParamsId(org.thingsboard.server.common.data.id.OAuth2ParamsId) OAuth2DomainId(org.thingsboard.server.common.data.id.OAuth2DomainId) OAuth2Domain(org.thingsboard.server.common.data.oauth2.OAuth2Domain)

Example 4 with OAuth2ParamsId

use of org.thingsboard.server.common.data.id.OAuth2ParamsId in project thingsboard by thingsboard.

the class OAuth2ParamsEntity method toData.

@Override
public OAuth2Params toData() {
    OAuth2Params oauth2Params = new OAuth2Params();
    oauth2Params.setId(new OAuth2ParamsId(id));
    oauth2Params.setCreatedTime(createdTime);
    oauth2Params.setTenantId(TenantId.fromUUID(tenantId));
    oauth2Params.setEnabled(enabled);
    return oauth2Params;
}
Also used : OAuth2ParamsId(org.thingsboard.server.common.data.id.OAuth2ParamsId) OAuth2Params(org.thingsboard.server.common.data.oauth2.OAuth2Params)

Aggregations

OAuth2ParamsId (org.thingsboard.server.common.data.id.OAuth2ParamsId)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 StringUtils (io.micrometer.core.instrument.util.StringUtils)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1 Column (javax.persistence.Column)1 Entity (javax.persistence.Entity)1 EnumType (javax.persistence.EnumType)1 Enumerated (javax.persistence.Enumerated)1 Table (javax.persistence.Table)1 Data (lombok.Data)1 EqualsAndHashCode (lombok.EqualsAndHashCode)1 Type (org.hibernate.annotations.Type)1 TypeDef (org.hibernate.annotations.TypeDef)1 OAuth2DomainId (org.thingsboard.server.common.data.id.OAuth2DomainId)1 OAuth2MobileId (org.thingsboard.server.common.data.id.OAuth2MobileId)1 OAuth2RegistrationId (org.thingsboard.server.common.data.id.OAuth2RegistrationId)1 MapperType (org.thingsboard.server.common.data.oauth2.MapperType)1