Skip to content

Commit

Permalink
feat: keycloak refactoring referred to Issue #5330 review (#6157)
Browse files Browse the repository at this point in the history
* feat(jans-keycloak-link): setup changes for keycloak migration review #5330

* chore: use only annotated beans

* chore: use only annotated beans

* chore: add fake beans producers

* chore: resolve dependency issues

* chore: reuse shared configuration in link and keycloack

* refactor(jans-keycloak-link): refactor the code to increase reusability

* refactor(jans-keycloak-link): refactor the code to increase reusability

* refactor(jans-keycloak-link): refactor the code to increase reusability

* Delete jans-config-api/docs/jans-config-api-swagger.yaml

* chore: update swagger docs files

* Revert "Delete jans-config-api/docs/jans-config-api-swagger.yaml"

This reverts commit e424397.

* refactor(jans-keycloak-link): refactor the pom version

---------

Co-authored-by: Yuriy Movchan <Yuriy.Movchan@gmail.com>
  • Loading branch information
shekhar16 and yurem authored Oct 11, 2023
1 parent f60010c commit 7319120
Show file tree
Hide file tree
Showing 76 changed files with 5,718 additions and 1,629 deletions.
8 changes: 3 additions & 5 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7460,15 +7460,13 @@ components:
type: string
adminCanView:
type: boolean
adminCanEdit:
userCanView:
type: boolean
userCanAccess:
type: boolean
userCanView:
type: boolean
whitePagesCanView:
adminCanEdit:
type: boolean
userCanEdit:
adminCanView:
type: boolean
adminCanAccess:
type: boolean
Expand Down
19 changes: 19 additions & 0 deletions jans-keycloak-link/model/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>jans-keycloak-link-parent</artifactId>
<groupId>io.jans</groupId>
<version>1.0.19-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jans-keycloak-link-model</artifactId>
<name>jans-keycloak-link-model</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-link-model</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* oxTrust is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2014, Gluu
*/

package io.jans.keycloak.link.model;

import java.io.Serializable;

/**
* Compound key with String[] array
*
* @author Yuriy Movchan Date: 07.21.2011
*/
public class CacheCompoundKey implements Serializable {

private static final long serialVersionUID = -3366537601347036591L;

private String primaryKeyValues;
private String secondaryKeyValues;
private String tertiaryKeyValues;

public CacheCompoundKey(String primaryKeyValues, String secondaryKeyValues, String tertiaryKeyValues) {
this.primaryKeyValues = primaryKeyValues;
this.secondaryKeyValues = secondaryKeyValues;
this.tertiaryKeyValues = tertiaryKeyValues;
}

public CacheCompoundKey(String[] keyValues) {
if (keyValues.length > 0) {
primaryKeyValues = keyValues[0];
}
if (keyValues.length > 1) {
secondaryKeyValues = keyValues[1];
}
if (keyValues.length > 2) {
tertiaryKeyValues = keyValues[2];
}
}

public String getPrimaryKeyValues() {
return primaryKeyValues;
}

public String getSecondaryKeyValues() {
return secondaryKeyValues;
}

public String getTertiaryKeyValues() {
return tertiaryKeyValues;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (null == primaryKeyValues ? 0 : primaryKeyValues.hashCode());
result = prime * result + (null == secondaryKeyValues ? 0 : secondaryKeyValues.hashCode());
result = prime * result + (null == tertiaryKeyValues? 0 : tertiaryKeyValues.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CacheCompoundKey other = (CacheCompoundKey) obj;
if (null != primaryKeyValues && !primaryKeyValues.equalsIgnoreCase(other.primaryKeyValues))
return false;
if (null != secondaryKeyValues && !secondaryKeyValues.equalsIgnoreCase(other.secondaryKeyValues))
return false;
if (null != tertiaryKeyValues && !tertiaryKeyValues.equalsIgnoreCase(other.tertiaryKeyValues))
return false;
return true;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CacheCompoundKey [primaryKeyValues=").append(primaryKeyValues).append(", secondaryKeyValues=")
.append(secondaryKeyValues).append(", tertiaryKeyValues=").append(tertiaryKeyValues)
.append("]");
return builder.toString();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* oxTrust is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2014, Gluu
*/

package io.jans.keycloak.link.model;

import io.jans.model.GluuStatus;
import io.jans.orm.annotation.AttributeName;
import io.jans.orm.annotation.DataEntry;
import io.jans.orm.annotation.ObjectClass;
import io.jans.orm.model.base.Entry;

import java.io.Serializable;

/**
* GluuInumMap
*
* @author Yuriy Movchan Date: 07.13.2011
*/
@DataEntry(sortBy = { "inum" })
@ObjectClass(value = "jansInumMap")
public class JansInumMap extends Entry implements Serializable {

private static final long serialVersionUID = -2190480357430436503L;

@AttributeName(ignoreDuringUpdate = true)
private String inum;

@AttributeName(name = "jansPrimaryKeyAttrName")
private String primaryKeyAttrName;

@AttributeName(name = "jansPrimaryKeyValue")
private String primaryKeyValues;

@AttributeName(name = "jansSecondaryKeyAttrName")
private String secondaryKeyAttrName;

@AttributeName(name = "jansSecondaryKeyValue")
private String secondaryKeyValues;

@AttributeName(name = "jansTertiaryKeyAttrName")
private String tertiaryKeyAttrName;

@AttributeName(name = "tertiaryKeyValue")
private String tertiaryKeyValues;

@AttributeName(name = "jansStatus")
private GluuStatus status;

public String getInum() {
return inum;
}

public void setInum(String inum) {
this.inum = inum;
}

public String getPrimaryKeyAttrName() {
return primaryKeyAttrName;
}

public void setPrimaryKeyAttrName(String primaryKeyAttrName) {
this.primaryKeyAttrName = primaryKeyAttrName;
}

public String getPrimaryKeyValues() {
return primaryKeyValues;
}

public void setPrimaryKeyValues(String primaryKeyValues) {
this.primaryKeyValues = primaryKeyValues;
}

public String getSecondaryKeyAttrName() {
return secondaryKeyAttrName;
}

public void setSecondaryKeyAttrName(String secondaryKeyAttrName) {
this.secondaryKeyAttrName = secondaryKeyAttrName;
}

public String getSecondaryKeyValues() {
return secondaryKeyValues;
}

public void setSecondaryKeyValues(String secondaryKeyValues) {
this.secondaryKeyValues = secondaryKeyValues;
}

public String getTertiaryKeyAttrName() {
return tertiaryKeyAttrName;
}

public void setTertiaryKeyAttrName(String tertiaryKeyAttrName) {
this.tertiaryKeyAttrName = tertiaryKeyAttrName;
}

public String getTertiaryKeyValues() {
return tertiaryKeyValues;
}

public void setTertiaryKeyValues(String tertiaryKeyValues) {
this.tertiaryKeyValues = tertiaryKeyValues;
}

public GluuStatus getStatus() {
return status;
}

public void setStatus(GluuStatus status) {
this.status = status;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GluuInumMap [inum=").append(inum).append(", primaryKeyAttrName=").append(primaryKeyAttrName)
.append(", primaryKeyValues=").append(primaryKeyValues).append(", secondaryKeyAttrName=")
.append(secondaryKeyAttrName).append(", secondaryKeyValues=").append(secondaryKeyValues)
.append(", tertiaryKeyAttrName=").append(tertiaryKeyAttrName).append(", tertiaryKeyValues=")
.append(tertiaryKeyValues).append(", status=").append(status).append("]");
return builder.toString();
}
}
Loading

0 comments on commit 7319120

Please sign in to comment.