Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jans-auth): new cluster beans and services #8667

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public class BaseDnConfiguration {
private String fido2Assertion;
@XmlElement(name = "archivedJwks")
private String archivedJwks;
@XmlElement(name = "nodes")
private String nodes;

public String getArchivedJwks() {
return archivedJwks;
Expand Down Expand Up @@ -244,4 +246,12 @@ public void setFido2Assertion(String fido2Assertion) {
this.fido2Assertion = fido2Assertion;
}

public String getNodes() {
return nodes;
}

public void setNodes(String nodes) {
this.nodes = nodes;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package io.jans.as.server.model.cluster;

import java.util.Date;

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

/**
* @author Yuriy Movchan
* @version 1.0, 06/03/2024
*/
@DataEntry(sortBy = "jansId")
@ObjectClass(value = "jansNode")
public class ClusterNode extends BaseEntry {

private static final long serialVersionUID = -2122431771066187529L;

@AttributeName(ignoreDuringUpdate = true, name = "jansNum")
private Integer id;

@AttributeName(name = "jansType")
private String type;

@AttributeName(name = "creationDate")
private Date creationDate;

@AttributeName(name = "jansLastUpd")
private Date lastUpdate;

@AttributeName(name = "lockKey")
private String lockkey;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public Date getCreationDate() {
return creationDate;
}

public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}

public Date getLastUpdate() {
return lastUpdate;
}

public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}

public String getLockkey() {
return lockkey;
}

public void setLockkey(String lockkey) {
this.lockkey = lockkey;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package io.jans.as.server.model.cluster;

import java.util.Date;

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

/**
* @author Yuriy Movchan
* @version 1.0, 06/03/2024
*/
@DataEntry(sortBy = "jansId")
@ObjectClass(value = "jansTokenPool")
public class TokenPool extends BaseEntry {

private static final long serialVersionUID = -2122431771066187529L;

@AttributeName(ignoreDuringUpdate = true, name = "jansNum")
private Integer id;

@AttributeName(ignoreDuringUpdate = true, name = "jansNodeId")
private Integer nodeId;

@AttributeName(name = "dat")
private String data;

@AttributeName(name = "tokenStatus")
private TokenStatus status;

@AttributeName(name = "jansLastUpd")
private Date lastUpdate;

@AttributeName(name = "lockKey")
private String lockkey;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Integer getNodeId() {
return nodeId;
}

public void setNodeId(Integer nodeId) {
this.nodeId = nodeId;
}

public String getData() {
return data;
}

public void setData(String data) {
this.data = data;
}

public TokenStatus getStatus() {
return status;
}

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

public Date getLastUpdate() {
return lastUpdate;
}

public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}

public String getLockkey() {
return lockkey;
}

public void setLockkey(String lockkey) {
this.lockkey = lockkey;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
*
* Copyright (c) 2020, Janssen Project
*/

package io.jans.as.server.model.cluster;

import java.util.HashMap;
import java.util.Map;

import io.jans.orm.annotation.AttributeEnum;

/**
* Token entry status
*
* @author Yuriy Movchan
* @version 1.0, 06/03/2024
*/
public enum TokenStatus implements AttributeEnum {

ACTIVE("inuse", "Inuse"), INACTIVE("free", "Free");

private String value;
private String displayName;

private static Map<String, TokenStatus> MAP_BY_VALUES = new HashMap<String, TokenStatus>();

static {
for (TokenStatus enumType : values()) {
MAP_BY_VALUES.put(enumType.getValue(), enumType);
}
}

TokenStatus(String value, String displayName) {
this.value = value;
this.displayName = displayName;
}

public String getValue() {
return value;
}

public String getDisplayName() {
return displayName;
}

public static TokenStatus getByValue(String value) {
return MAP_BY_VALUES.get(value);
}

public Enum<? extends AttributeEnum> resolveByValue(String value) {
return getByValue(value);
}

@Override
public String toString() {
return value;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
*/
@ApplicationScoped
@DependsOn("appInitializer")
@Named
public class CleanerTimer {

public static final int BATCH_SIZE = 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@

package io.jans.as.server.service;

import static org.apache.commons.lang3.BooleanUtils.isTrue;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import org.apache.commons.lang3.BooleanUtils;
import org.json.JSONArray;
import org.slf4j.Logger;

import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;

import io.jans.as.common.model.registration.Client;
import io.jans.as.model.common.AuthenticationMethod;
import io.jans.as.model.config.StaticConfiguration;
Expand All @@ -23,18 +34,8 @@
import io.jans.util.StringHelper;
import io.jans.util.security.StringEncrypter;
import io.jans.util.security.StringEncrypter.EncryptionException;
import jakarta.ejb.Stateless;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import org.apache.commons.lang3.BooleanUtils;
import org.json.JSONArray;
import org.slf4j.Logger;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import static org.apache.commons.lang3.BooleanUtils.isTrue;

/**
* Provides operations with clients.
Expand All @@ -43,8 +44,7 @@
* @author Yuriy Movchan Date: 04/15/2014
* @version October 22, 2016
*/
@Stateless
@Named
@ApplicationScoped
public class ClientService {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@

package io.jans.as.server.service;

import static org.apache.commons.lang.BooleanUtils.isTrue;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;

import com.google.common.collect.Lists;

import io.jans.as.model.config.StaticConfiguration;
import io.jans.as.model.configuration.AppConfiguration;
import io.jans.as.model.configuration.LockMessageConfig;
Expand All @@ -21,26 +32,15 @@
import io.jans.service.MessageService;
import io.jans.service.cache.CacheConfiguration;
import io.jans.util.StringHelper;
import jakarta.ejb.Stateless;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;

import static org.apache.commons.lang.BooleanUtils.isTrue;

/**
* @author Yuriy Zabrovarnyy
* @author Javier Rojas Blum
* @version November 28, 2018
*/
@Stateless
@Named
@ApplicationScoped
public class GrantService {

@Inject
Expand Down
Loading