-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
238 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
backend/src/main/kotlin/hu/bme/sch/cmsch/model/Oauth2AuthorizedClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package hu.bme.sch.cmsch.model | ||
|
||
import jakarta.persistence.* | ||
import jakarta.validation.constraints.NotNull | ||
import jakarta.validation.constraints.Size | ||
import org.hibernate.annotations.ColumnDefault | ||
import java.time.Instant | ||
|
||
/** | ||
* Created for JdbcOAuth2AuthorizedClientService | ||
*/ | ||
@Entity | ||
@Table(name = "OAUTH2_AUTHORIZED_CLIENT") | ||
open class Oauth2AuthorizedClient { | ||
@EmbeddedId | ||
open var id: Oauth2AuthorizedClientId? = null | ||
|
||
@Size(max = 100) | ||
@NotNull | ||
@Column(name = "ACCESS_TOKEN_TYPE", nullable = false, length = 100) | ||
open var accessTokenType: String? = null | ||
|
||
@NotNull | ||
@Column(name = "ACCESS_TOKEN_ISSUED_AT", nullable = false) | ||
open var accessTokenIssuedAt: Instant? = null | ||
|
||
@NotNull | ||
@Column(name = "ACCESS_TOKEN_EXPIRES_AT", nullable = false) | ||
open var accessTokenExpiresAt: Instant? = null | ||
|
||
@Size(max = 1000) | ||
@ColumnDefault("NULL") | ||
@Column(name = "ACCESS_TOKEN_SCOPES", length = 1000) | ||
open var accessTokenScopes: String? = null | ||
|
||
@ColumnDefault("NULL") | ||
@Column(name = "REFRESH_TOKEN_ISSUED_AT") | ||
open var refreshTokenIssuedAt: Instant? = null | ||
|
||
@NotNull | ||
@ColumnDefault("CURRENT_TIMESTAMP") | ||
@Column(name = "CREATED_AT", nullable = false) | ||
open var createdAt: Instant? = null | ||
|
||
@Column(name = "ACCESS_TOKEN_VALUE", length = Integer.MAX_VALUE) | ||
open var accessTokenValue: ByteArray? = null | ||
|
||
@ColumnDefault("NULL") | ||
@Column(name = "REFRESH_TOKEN_VALUE", length = Integer.MAX_VALUE) | ||
open var refreshTokenValue: ByteArray? = null | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
backend/src/main/kotlin/hu/bme/sch/cmsch/model/Oauth2AuthorizedClientId.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package hu.bme.sch.cmsch.model | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Embeddable | ||
import jakarta.validation.constraints.NotNull | ||
import jakarta.validation.constraints.Size | ||
import org.hibernate.Hibernate | ||
import java.io.Serializable | ||
import java.util.* | ||
|
||
/** | ||
* Created for JdbcOAuth2AuthorizedClientService | ||
*/ | ||
@Embeddable | ||
open class Oauth2AuthorizedClientId : Serializable { | ||
@Size(max = 100) | ||
@NotNull | ||
@Column(name = "CLIENT_REGISTRATION_ID", nullable = false, length = 100) | ||
open var clientRegistrationId: String? = null | ||
|
||
@Size(max = 200) | ||
@NotNull | ||
@Column(name = "PRINCIPAL_NAME", nullable = false, length = 200) | ||
open var principalName: String? = null | ||
override fun hashCode(): Int = Objects.hash(clientRegistrationId, principalName) | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (other == null || Hibernate.getClass(this) != Hibernate.getClass(other)) return false | ||
|
||
other as Oauth2AuthorizedClientId | ||
|
||
return clientRegistrationId == other.clientRegistrationId && | ||
principalName == other.principalName | ||
} | ||
|
||
companion object { | ||
private const val serialVersionUID = 0L | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
backend/src/main/kotlin/hu/bme/sch/cmsch/model/SpringSession.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package hu.bme.sch.cmsch.model | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.Table | ||
import jakarta.validation.constraints.NotNull | ||
import jakarta.validation.constraints.Size | ||
|
||
@Entity | ||
@Table(name = "SPRING_SESSION") | ||
open class SpringSession { | ||
@Id | ||
@Size(max = 36) | ||
@Column(name = "PRIMARY_ID", nullable = false, length = 36) | ||
open var primaryId: String? = null | ||
|
||
@Size(max = 36) | ||
@NotNull | ||
@Column(name = "SESSION_ID", nullable = false, length = 36) | ||
open var sessionId: String? = null | ||
|
||
@NotNull | ||
@Column(name = "CREATION_TIME", nullable = false) | ||
open var creationTime: Long? = null | ||
|
||
@NotNull | ||
@Column(name = "LAST_ACCESS_TIME", nullable = false) | ||
open var lastAccessTime: Long? = null | ||
|
||
@NotNull | ||
@Column(name = "MAX_INACTIVE_INTERVAL", nullable = false) | ||
open var maxInactiveInterval: Int? = null | ||
|
||
@NotNull | ||
@Column(name = "EXPIRY_TIME", nullable = false) | ||
open var expiryTime: Long? = null | ||
|
||
@Size(max = 100) | ||
@Column(name = "PRINCIPAL_NAME", length = 100) | ||
open var principalName: String? = null | ||
} |
23 changes: 23 additions & 0 deletions
23
backend/src/main/kotlin/hu/bme/sch/cmsch/model/SpringSessionAttribute.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package hu.bme.sch.cmsch.model | ||
|
||
import jakarta.persistence.* | ||
import jakarta.validation.constraints.NotNull | ||
import org.hibernate.annotations.OnDelete | ||
import org.hibernate.annotations.OnDeleteAction | ||
|
||
@Entity | ||
@Table(name = "SPRING_SESSION_ATTRIBUTES") | ||
open class SpringSessionAttribute { | ||
@EmbeddedId | ||
open var id: SpringSessionAttributeId? = null | ||
|
||
@MapsId("sessionPrimaryId") | ||
@ManyToOne(fetch = FetchType.LAZY, optional = false) | ||
@OnDelete(action = OnDeleteAction.CASCADE) | ||
@JoinColumn(name = "SESSION_PRIMARY_ID", nullable = false) | ||
open var sessionPrimary: SpringSession? = null | ||
|
||
@NotNull | ||
@Column(name = "ATTRIBUTE_BYTES", nullable = false, length = Integer.MAX_VALUE) | ||
open var attributeBytes: ByteArray? = null | ||
} |
36 changes: 36 additions & 0 deletions
36
backend/src/main/kotlin/hu/bme/sch/cmsch/model/SpringSessionAttributeId.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package hu.bme.sch.cmsch.model | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Embeddable | ||
import jakarta.validation.constraints.NotNull | ||
import jakarta.validation.constraints.Size | ||
import org.hibernate.Hibernate | ||
import java.io.Serializable | ||
import java.util.* | ||
|
||
@Embeddable | ||
open class SpringSessionAttributeId : Serializable { | ||
@Size(max = 36) | ||
@NotNull | ||
@Column(name = "SESSION_PRIMARY_ID", nullable = false, length = 36) | ||
open var sessionPrimaryId: String? = null | ||
|
||
@Size(max = 200) | ||
@NotNull | ||
@Column(name = "ATTRIBUTE_NAME", nullable = false, length = 200) | ||
open var attributeName: String? = null | ||
override fun hashCode(): Int = Objects.hash(sessionPrimaryId, attributeName) | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (other == null || Hibernate.getClass(this) != Hibernate.getClass(other)) return false | ||
|
||
other as SpringSessionAttributeId | ||
|
||
return sessionPrimaryId == other.sessionPrimaryId && | ||
attributeName == other.attributeName | ||
} | ||
|
||
companion object { | ||
private const val serialVersionUID = 0L | ||
} | ||
} |