本文整理汇总了Java中org.jboss.seam.contexts.Contexts类的典型用法代码示例。如果您正苦于以下问题:Java Contexts类的具体用法?Java Contexts怎么用?Java Contexts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Contexts类属于org.jboss.seam.contexts包,在下文中一共展示了Contexts类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAuthorizedUser
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
protected boolean getAuthorizedUser() {
try {
GluuCustomPerson authUser = (GluuCustomPerson) Contexts.getSessionContext().get(OxTrustConstants.CURRENT_PERSON);
if (authUser == null) {
return false;
}
GluuAppliance appliance = applianceService.getAppliance();
if (appliance == null) {
return false;
}
if (!(GluuBoolean.TRUE.equals(appliance.getScimEnabled()) || GluuBoolean.ENABLED.equals(appliance.getScimEnabled()))) {
return false;
}
return true;
} catch (Exception ex) {
log.error("Exception: ", ex);
return false;
}
}
示例2: logConnectionProviderStatistic
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
public void logConnectionProviderStatistic(String connectionProvider, String bindConnectionProvider) {
if ((connectionProvider != null) && Contexts.getApplicationContext().isSet(connectionProvider)) {
LDAPConnectionProvider ldapConnectionProvider = (LDAPConnectionProvider) Contexts.getApplicationContext().get(connectionProvider);
if (ldapConnectionProvider.getConnectionPool() == null) {
log.error("{0} is empty", connectionProvider);
} else {
log.info("{0} statistics: {1}", connectionProvider, ldapConnectionProvider.getConnectionPool().getConnectionPoolStatistics());
}
}
if ((bindConnectionProvider != null) && Contexts.getApplicationContext().isSet(bindConnectionProvider)) {
LDAPConnectionProvider bindLdapConnectionProvider = (LDAPConnectionProvider) Contexts.getApplicationContext().get(bindConnectionProvider);
if (bindLdapConnectionProvider.getConnectionPool() == null) {
log.error("{0} is empty", bindConnectionProvider);
} else {
log.info("{0} statistics: {1}", bindConnectionProvider, bindLdapConnectionProvider.getConnectionPool().getConnectionPoolStatistics());
}
}
}
示例3: createConnectionAuthProvider
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
private void createConnectionAuthProvider(String configurationLdapConfigComponentName, String fileName, String configurationComponentName, String connectionProviderComponentName) {
FileConfiguration configuration = new FileConfiguration(fileName);
Contexts.getApplicationContext().set(configurationComponentName, configuration);
//
Properties properties = configuration.getProperties();
if (this.ldapConfig != null) {
Contexts.getApplicationContext().set(configurationLdapConfigComponentName, this.ldapConfig);
properties.setProperty("servers", buildServersString(this.ldapConfig.getServers()));
properties.setProperty("bindDN", this.ldapConfig.getBindDN());
properties.setProperty("bindPassword", this.ldapConfig.getBindPassword());
properties.setProperty("useSSL", Boolean.toString(this.ldapConfig.isUseSSL()));
}
//
LdapConnectionService connectionProvider = new LdapConnectionService(PropertiesDecrypter.decryptProperties(properties, oxTrustConfiguration.getCryptoConfigurationSalt()));
Contexts.getApplicationContext().set(connectionProviderComponentName, connectionProvider);
}
示例4: destroyApplicationComponents
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
/**
* When application undeploy we need to close LDAP Connections
*
* @throws org.apache.commons.configuration.ConfigurationException
*/
// @Destroy
public void destroyApplicationComponents() throws ConfigurationException {
log.debug("Destroying application components");
LdapEntryManager ldapEntryManager = (LdapEntryManager) Contexts.getApplicationContext().get(LDAP_ENTRY_MANAGER_NAME);
ldapEntryManager.destroy();
LdapEntryManager ldapAuthEntryManager = (LdapEntryManager) Contexts.getApplicationContext().get(LDAP_AUTH_ENTRY_MANAGER_NAME);
if (ldapAuthEntryManager != null) {
ldapAuthEntryManager.destroy();
}
LdapEntryManager ldapCentralEntryManager = (LdapEntryManager) Contexts.getApplicationContext().get(LDAP_CENTRAL_ENTRY_MANAGER_NAME);
if (ldapCentralEntryManager != null) {
ldapCentralEntryManager.destroy();
}
}
示例5: recreateCentralLdapEntryManager
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
@Observer(OxTrustConfiguration.LDAP_CENTRAL_CONFIGUARION_RELOAD_EVENT_TYPE)
public void recreateCentralLdapEntryManager() {
// Backup current references to objects to allow shutdown properly
LdapEntryManager oldCentralLdapEntryManager = (LdapEntryManager) Component.getInstance(LDAP_CENTRAL_ENTRY_MANAGER_NAME);
// Recreate components
if ((oxTrustConfiguration.getLdapCentralConfiguration() != null) && oxTrustConfiguration.getApplicationConfiguration().isUpdateApplianceStatus()) {
createConnectionProvider(oxTrustConfiguration.getLdapCentralConfiguration(), "centralLdapConfiguration", "centralConnectionProvider");
} else {
Contexts.getApplicationContext().remove("centralConnectionProvider");
}
// Destroy old components
Contexts.getApplicationContext().remove(LDAP_CENTRAL_ENTRY_MANAGER_NAME);
if (oldCentralLdapEntryManager != null) {
oldCentralLdapEntryManager.destroy();
log.debug("Destroyed {0}: {1}", LDAP_CENTRAL_ENTRY_MANAGER_NAME, oldCentralLdapEntryManager);
}
}
示例6: logout
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
public String logout() {
boolean isShib2Authentication = OxTrustConstants.APPLICATION_AUTHORIZATION_NAME_SHIBBOLETH2.equals(Contexts.getSessionContext().get(
OxTrustConstants.APPLICATION_AUTHORIZATION_TYPE));
if (isShib2Authentication) {
// After this redirect we should invalidate this session
try {
HttpServletResponse userResponse = (HttpServletResponse) facesContext.getExternalContext().getResponse();
HttpServletRequest userRequest = (HttpServletRequest) facesContext.getExternalContext().getRequest();
String redirectUrl = String.format("%s%s", applicationConfiguration.getIdpUrl(), "/idp/logout.jsp");
String url = String.format("%s://%s/Shibboleth.sso/Logout?return=%s", userRequest.getScheme(), userRequest.getServerName(),
redirectUrl);
userResponse.sendRedirect(url);
facesContext.responseComplete();
} catch (IOException ex) {
log.error("Failed to redirect to SSO logout page", ex);
}
}
return isShib2Authentication ? OxTrustConstants.RESULT_LOGOUT_SSO : OxTrustConstants.RESULT_LOGOUT;
}
示例7: postLogin
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
/**
* Set session variables after user login
*
* @throws Exception
*/
private void postLogin(User user) {
log.debug("Configuring application after user '{0}' login", user.getUid());
GluuCustomPerson person = findPersonByDn(user.getDn());
Contexts.getSessionContext().set(OxTrustConstants.CURRENT_PERSON, person);
// Set user roles
GluuUserRole[] userRoles = securityService.getUserRoles(user);
if (ArrayHelper.isNotEmpty(userRoles)) {
log.debug("Get '{0}' user roles", Arrays.toString(userRoles));
} else {
log.debug("Get 0 user roles");
}
for (GluuUserRole userRole : userRoles) {
identity.addRole(userRole.getRoleName());
}
if (log.isDebugEnabled()) {
for (Group sg : identity.getSubject().getPrincipals(java.security.acl.Group.class)) {
if ("Roles".equals(sg.getName())) {
log.debug("Using next user roles: '{0}'", sg.members());
break;
}
}
}
}
示例8: init
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
@Create
public void init() {
System.setProperty("com.workplacesystems.queuj.QueujFactory", "com.workplacesystems.queuj.process.seam.SeamFactory");
RunOnce occurrence = new RunOnce();
RelativeScheduleBuilder rsb = occurrence.newRelativeScheduleBuilder();
rsb.setRunImmediately();
rsb.createSchedule();
QueueBuilder<SeamProcessBuilder> qb = QueueFactory.ROOT_QUEUE.newQueueBuilder(SeamProcessBuilder.class);
qb.setQueueRestriction(new JavaQueueRestriction());
qb.setBatchProcessServerClass(SeamProcessServer.class);
qb.setDefaultOccurrence(occurrence);
qb.setDefaultResilience(new RunOnlyOnce());
Queue<SeamProcessBuilder> seamQueue = qb.newQueue();
Contexts.getApplicationContext().set("DEFAULT_QUEUE", seamQueue);
QueujFactory.getProcessServer((String)null, null);
}
示例9: postLogin
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
public void postLogin(GluuCustomPerson person) throws Exception {
log.debug("Configuring application after user '{0}' login", person.getUid());
Contexts.getSessionContext().set(OxTrustConstants.CURRENT_PERSON, person);
// Set user roles
GluuUserRole[] userRoles = securityService.getUserRoles(person);
for (GluuUserRole userRole : userRoles) {
identity.addRole(userRole.getRoleName());
}
}
示例10: createConnectionProvider
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
private void createConnectionProvider(FileConfiguration configuration, String configurationComponentName, String connectionProviderComponentName) {
Contexts.getApplicationContext().set(configurationComponentName, configuration);
LdapConnectionService connectionProvider = null;
if (configuration != null) {
connectionProvider = new LdapConnectionService(PropertiesDecrypter.decryptProperties(configuration
.getProperties(), oxTrustConfiguration.getCryptoConfigurationSalt()));
}
Contexts.getApplicationContext().set(connectionProviderComponentName, connectionProvider);
}
示例11: createLdapEntryManager
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
@Factory(value = LDAP_ENTRY_MANAGER_NAME, scope = ScopeType.APPLICATION, autoCreate = true)
public LdapEntryManager createLdapEntryManager() {
LdapConnectionService connectionProvider = (LdapConnectionService) Contexts.getApplicationContext().get("connectionProvider");
LdapEntryManager ldapEntryManager = new LdapEntryManager(new OperationsFacade(connectionProvider));
log.debug("Created site LdapEntryManager: " + ldapEntryManager);
return ldapEntryManager;
}
示例12: createCentralLdapEntryManager
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
@Factory(value = LDAP_CENTRAL_ENTRY_MANAGER_NAME, scope = ScopeType.APPLICATION, autoCreate = true)
public LdapEntryManager createCentralLdapEntryManager() {
LdapConnectionService centralConnectionProvider = (LdapConnectionService) Contexts.getApplicationContext().get("centralConnectionProvider");
if (centralConnectionProvider == null) {
return null;
}
log.debug("Created central LdapEntryManager: " + centralConnectionProvider);
LdapEntryManager centralLdapEntryManager = new LdapEntryManager(new OperationsFacade(centralConnectionProvider));
log.debug("Created central LdapEntryManager: " + centralLdapEntryManager);
return centralLdapEntryManager;
}
示例13: createLdapAuthEntryManager
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
@Factory(value = "ldapAuthEntryManager", scope = ScopeType.APPLICATION, autoCreate = true)
public LdapEntryManager createLdapAuthEntryManager() {
LdapConnectionService connectionProvider = (LdapConnectionService) Contexts.getApplicationContext().get("authConnectionProvider");
LdapEntryManager ldapAuthEntryManager = new LdapEntryManager(new OperationsFacade(connectionProvider, null));
// LDAP_ENTRY_MANAGER_NAME.addDeleteSubscriber(new
// LdifArchiver(LDAP_ENTRY_MANAGER_NAME));
log.debug("Created site LdapAuthEntryManager: " + ldapAuthEntryManager);
return ldapAuthEntryManager;
}
示例14: recreateLdapEntryManager
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
@Observer(OxTrustConfiguration.LDAP_CONFIGUARION_RELOAD_EVENT_TYPE)
public void recreateLdapEntryManager() {
// Backup current references to objects to allow shutdown properly
LdapEntryManager oldLdapEntryManager = (LdapEntryManager) Component.getInstance(LDAP_ENTRY_MANAGER_NAME);
// Recreate components
createConnectionProvider(oxTrustConfiguration.getLdapConfiguration(), "localLdapConfiguration", "connectionProvider");
// Destroy old components
Contexts.getApplicationContext().remove(LDAP_ENTRY_MANAGER_NAME);
oldLdapEntryManager.destroy();
log.debug("Destroyed {0}: {1}", LDAP_ENTRY_MANAGER_NAME, oldLdapEntryManager);
}
示例15: recreateLdapAuthEntryManagers
import org.jboss.seam.contexts.Contexts; //导入依赖的package包/类
public void recreateLdapAuthEntryManagers() {
// Backup current references to objects to allow shutdown properly
LdapEntryManager oldLdapAuthEntryManager = (LdapEntryManager) Component.getInstance(LDAP_AUTH_ENTRY_MANAGER_NAME);
// Recreate components
createConnectionAuthProvider("ldapAuthConfig", oxTrustConfiguration.getLdapConfiguration().getFileName(), "localLdapAuthConfiguration", "authConnectionProvider");
// Destroy old components
Contexts.getApplicationContext().remove(LDAP_AUTH_ENTRY_MANAGER_NAME);
oldLdapAuthEntryManager.destroy();
log.debug("Destroyed {0}: {1}", LDAP_CENTRAL_ENTRY_MANAGER_NAME, oldLdapAuthEntryManager);
}