Commit b67c173c authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '13-oauth-client-properties' into 'master'

Resolve "OAuth client properties"

Closes #13

See merge request !14
parents eab34799 42f18596
......@@ -30,6 +30,7 @@ import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.PostLoad;
import javax.persistence.PrePersist;
import javax.persistence.Table;
......@@ -59,6 +60,7 @@ public class OAuthClient extends AuditedVersionedModel implements ClientDetails
@Column(nullable = false)
boolean autoApprove = false;
@Column(nullable = true, length = 200)
private String autoApproveScope;
@Transient
......@@ -81,7 +83,7 @@ public class OAuthClient extends AuditedVersionedModel implements ClientDetails
@ElementCollection
@Enumerated(EnumType.STRING)
@CollectionTable(name = "clientrole", joinColumns = @JoinColumn(name = "clientId"))
@CollectionTable(name = "oauthclientrole", joinColumns = @JoinColumn(name = "clientId"))
@Column(name = "oauthclientrole")
private Collection<OAuthRole> roles = new ArrayList<>();
......@@ -91,6 +93,12 @@ public class OAuthClient extends AuditedVersionedModel implements ClientDetails
private Integer accessTokenValidity;
private Integer refreshTokenValidity;
@Column(nullable = false, length = 200)
private String title;
@Lob
private String description;
@PrePersist
private void flatten() {
resource = resourceIds.stream().collect(Collectors.joining(";"));
......@@ -267,4 +275,19 @@ public class OAuthClient extends AuditedVersionedModel implements ClientDetails
return additionalInformation;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
databaseChangeLog:
- changeSet:
id: application-blocks-security-1506594404000-1
author: mobreza
comment: Rename 'clientrole' to 'oauthclientrole'
changes:
- renameTable:
oldTableName: clientrole
newTableName: oauthclientrole
- changeSet:
id: application-blocks-security-1506594404000-2
author: matijaobreza
comment: Create 'oauthclientrole'
changes:
- createTable:
tableName: oauthclientrole
remarks: OAuth Client role list
columns:
- column:
name: client_id
type: bigint
constraints:
nullable: false
- column:
name: oauthclientrole
type: varchar(200)
constraints:
nullable: false
- addForeignKeyConstraint:
constraintName: FK_m2da63y1tfs7mmuv9rht8udt7
baseTableName: oauthclientrole
baseColumnNames: client_id
referencedTableName: oauthclient
referencedColumnNames: id
onDelete: CASCADE
onUpdate: CASCADE
- changeSet:
id: application-blocks-security-1506594404000-3
author: matijaobreza
comment: Add title, description
changes:
- addColumn:
tableName: oauthclient
columns:
- column:
name: title
type: varchar(200)
constraints:
nullable: false
- column:
name: description
type: clob
......@@ -102,6 +102,7 @@ public class OAuth2GrantTypeTest extends AbstractRestTest {
private OAuthClient makeDefault() {
final OAuthClient client = new OAuthClient();
client.setTitle("JUnit OAuth client");
client.setClientId(DEFAULT_CLIENT_ID);
client.setClientSecret(DEFAULT_CLIENT_SECRET);
client.getAuthorizedGrantTypes().add("client_credentials");
......
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