Merge ffa349ce1c
into d074573de0
commit
105a76f7e7
|
@ -19,17 +19,19 @@ package org.mitre.oauth2.model.convert;
|
||||||
import javax.persistence.AttributeConverter;
|
import javax.persistence.AttributeConverter;
|
||||||
import javax.persistence.Converter;
|
import javax.persistence.Converter;
|
||||||
|
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jricher
|
* @author jricher
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Converter
|
@Converter
|
||||||
public class SimpleGrantedAuthorityStringConverter implements AttributeConverter<SimpleGrantedAuthority, String> {
|
public class SimpleGrantedAuthorityStringConverter implements AttributeConverter<GrantedAuthority, String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertToDatabaseColumn(SimpleGrantedAuthority attribute) {
|
public String convertToDatabaseColumn(GrantedAuthority attribute) {
|
||||||
if (attribute != null) {
|
if (attribute != null) {
|
||||||
return attribute.getAuthority();
|
return attribute.getAuthority();
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,7 +40,7 @@ public class SimpleGrantedAuthorityStringConverter implements AttributeConverter
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SimpleGrantedAuthority convertToEntityAttribute(String dbData) {
|
public GrantedAuthority convertToEntityAttribute(String dbData) {
|
||||||
if (dbData != null) {
|
if (dbData != null) {
|
||||||
return new SimpleGrantedAuthority(dbData);
|
return new SimpleGrantedAuthority(dbData);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue