Skip to content

Commit

Permalink
disable static admin token
Browse files Browse the repository at this point in the history
  • Loading branch information
vharseko committed Dec 8, 2023
1 parent 86e9ec1 commit 9050fbf
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@
public class AgentDumpModelImpl extends AMModelBase implements AgentDumpModel
{

private static SSOToken adminSSOToken = AMAdminUtils.getSuperAdminSSOToken();

public AgentDumpModelImpl(HttpServletRequest req, Map map) {
super(req, map);
}

public Map getAttributeValues(String universalId)
throws AMConsoleException {
try {
final SSOToken adminSSOToken = AMAdminUtils.getSuperAdminSSOToken();
AMIdentity amid = IdUtils.getIdentity(adminSSOToken, universalId);
Map values = AgentConfiguration.getAgentAttributes(amid, true);
return values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

public class AgentExportPolicyModelImpl extends AMModelBase implements AgentExportPolicyModel {

// private static SSOToken adminSSOToken = AMAdminUtils.getSuperAdminSSOToken();
public AgentExportPolicyModelImpl(HttpServletRequest req, Map map) {
super(req, map);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
public class AMCommonNameGenerator
implements AMAdminConstants, ServiceListener
{
private static SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();

private static final String DEFAULT_FORMAT = "{cn}";

Expand All @@ -82,6 +80,8 @@ private AMCommonNameGenerator() {

private void initialize() {
try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
serviceSchemaManager = new ServiceSchemaManager(
G11N_SERVICE_NAME, adminSSOToken);
serviceConfigManager = new ServiceConfigManager(
Expand Down Expand Up @@ -172,6 +172,8 @@ public String generateCommonName(String univId, AMModel model)
private Map getUserAttributeValues(String univId) {
Map values = null;
try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
AMIdentity amid = IdUtils.getIdentity(adminSSOToken, univId);
if (amid != null) {
Map map = amid.getAttributes();
Expand Down Expand Up @@ -208,6 +210,8 @@ private Map getAttributeSchemaExactNames(String idType)
Map mapping = new HashMap();
String serviceName = IdUtils.getServiceName(IdUtils.getType(idType));
if (serviceName != null) {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
ServiceSchemaManager svcSchemaMgr = new ServiceSchemaManager(
serviceName, adminSSOToken);
ServiceSchema svcSchema = svcSchemaMgr.getSchema(idType);
Expand Down Expand Up @@ -291,6 +295,8 @@ private Map addFormats(String realm) {
Map map = null;

try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
AMIdentityRepository repo = new AMIdentityRepository(
adminSSOToken, realm);
AMIdentity realmIdentity = repo.getRealmIdentity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
public class SubConfigMeta {
public static final String SUBCONFIG_ID_DELIMITER = "/";

private static SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();

private String serviceName;
private AMModel amModel;
Expand Down Expand Up @@ -173,6 +171,8 @@ public Map getServiceSchemaDefaultValues(String name)

private void initialize() {
try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
ServiceConfigManager mgr = new ServiceConfigManager(
serviceName, adminSSOToken);
globalConfig = mgr.getGlobalConfig(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public class EntitiesModelImpl
private static boolean isWSSEnabled = false;

private boolean endUser = false;
private static SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();

private static RequiredValueValidator reqValidator =
new RequiredValueValidator();
private Map requiredAttributeNames = new HashMap();
Expand Down Expand Up @@ -821,6 +820,8 @@ public boolean canAssignService(String realmName, String idType) {
boolean can = false;

try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
AMIdentityRepository repo = new AMIdentityRepository(
adminSSOToken, realmName);
Set allowedOperations = repo.getAllowedIdOperations(
Expand Down Expand Up @@ -1642,6 +1643,8 @@ public void unassignServices(String universalId, Set serviceNames)
public String getPropertiesViewBean(String name) {
String url = null;
try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
ServiceSchemaManager mgr = new ServiceSchemaManager(
name, adminSSOToken);
ServiceSchema schema = mgr.getSchema(SchemaType.USER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ public class PolicyModelImpl
private Map mapSvcNameToManagedResource = new HashMap();
private Set requiredResourceNameService = new HashSet();
private Set notRequiredResourceNameService = new HashSet();
private static SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();

/**
* Creates a simple model using default resource bundle.
Expand Down Expand Up @@ -1815,6 +1813,8 @@ public String canCreatePolicy(String realmName) {

private boolean hasPolicyConfigSvcRegistered(String realmName) {
try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(
adminSSOToken, realmName);
Set names = orgCfgMgr.getAssignedServices();
Expand Down Expand Up @@ -1905,6 +1905,8 @@ public Set getAuthInstances(String realmName) {
Set instances = null;

try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
AMAuthenticationManager mgr = new AMAuthenticationManager(
adminSSOToken, realmName);
Set inst = mgr.getAuthenticationInstances();
Expand Down Expand Up @@ -1934,6 +1936,8 @@ public String getAuthenticationLevel(String realmName, String name) {
String level = "0";

try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
AMAuthenticationManager mgr = new AMAuthenticationManager(
adminSSOToken, realmName);
AMAuthenticationInstance ai = mgr.getAuthenticationInstance(name);
Expand Down Expand Up @@ -1971,6 +1975,8 @@ public Set getRealmNames(String base, String filter)
logEvent("ATTEMPT_GET_REALM_NAMES", param);

try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
OrganizationConfigManager orgMgr = new OrganizationConfigManager(
adminSSOToken, base);
logEvent("SUCCEED_GET_REALM_NAMES", param);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ public class UMUserPasswordResetOptionsModelImpl
implements UMUserPasswordResetOptionsModel
{
private OrganizationConfigManager orgCfgMgr;
private static SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();

public UMUserPasswordResetOptionsModelImpl(
HttpServletRequest req,
Expand Down Expand Up @@ -500,6 +498,8 @@ private OrganizationConfigManager getOrganizationConfigManager(
String realmName) {
if (orgCfgMgr == null) {
try {
SSOToken adminSSOToken =
AMAdminUtils.getSuperAdminSSOToken();
orgCfgMgr = new OrganizationConfigManager(
adminSSOToken, realmName);
} catch (SMSException e) {
Expand Down

0 comments on commit 9050fbf

Please sign in to comment.