Skip to content

Commit

Permalink
Rename webapp modules into support modules (apereo#1789)
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvasMisaghMoayyed committed May 23, 2016
1 parent 1b6cc11 commit 876cc8a
Show file tree
Hide file tree
Showing 129 changed files with 307 additions and 307 deletions.
2 changes: 1 addition & 1 deletion cas-management-webapp-support/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ dependencies {
compile project(':cas-server-support-oauth-core')


testCompile project(':cas-server-webapp-cookie')
testCompile project(':cas-server-support-cookie')
}
2 changes: 1 addition & 1 deletion cas-server-core-audit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ dependencies {
testCompile project(':cas-server-core-util')
testCompile project(path: ":cas-server-core-authentication", configuration: "tests")
testCompile project(':cas-server-core')
testCompile project(':cas-server-webapp-cookie')
testCompile project(':cas-server-support-cookie')
testCompile project(path: ":cas-server-core", configuration: "tests")
}
2 changes: 1 addition & 1 deletion cas-server-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies {
testCompile project(':cas-server-core-util')
testCompile project(':cas-server-core-logout')
testCompile project(':cas-server-core-monitor')
testCompile project(':cas-server-webapp-cookie')
testCompile project(':cas-server-support-cookie')
testCompile project(path: ":cas-server-core-services", configuration: "tests")
testCompile project(path: ":cas-server-core-authentication", configuration: "tests")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
description = 'Apereo CAS AUP LDAP Support'
dependencies {
compile project(':cas-server-core-webflow')
compile project(':cas-server-webapp-actions')
compile project(':cas-server-webapp-actions-aup-webflow')
compile project(':cas-server-support-actions')
compile project(':cas-server-support-actions-aup-webflow')
compile project(':cas-server-support-ldap-core')
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
description = 'Apereo CAS AUP Webflow Support'
dependencies {
compile project(':cas-server-core-webflow')
compile project(':cas-server-webapp-actions')
compile project(':cas-server-support-actions')
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
description = 'Apereo CAS Web Application Spring Webflow Actions'
dependencies {
compile project(':cas-server-webapp-cookie')
compile project(':cas-server-support-cookie')
compile project(':cas-server-core-web')
compile project(':cas-server-core-webflow')
compile project(':cas-server-core-authentication')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
package org.apereo.cas.web.flow;

import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.services.RegisteredService;
import org.apereo.cas.services.ServicesManager;
import org.apereo.cas.services.UnauthorizedServiceException;
import org.apereo.cas.web.support.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import org.springframework.webflow.action.AbstractAction;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;

/**
* Performs a basic check if an authentication request for a provided service is authorized to proceed
* based on the registered services registry configuration (or lack thereof).
*
* @author Dmitriy Kopylenko
* @since 3.5.1
**/
@RefreshScope
@Component("serviceAuthorizationCheck")
public class ServiceAuthorizationCheck extends AbstractAction {


private ServicesManager servicesManager;

private transient Logger logger = LoggerFactory.getLogger(this.getClass());

/**
* Initialize the component with an instance of the services manager.
* @param servicesManager the service registry instance.
*/
@Autowired
public ServiceAuthorizationCheck(@Qualifier("servicesManager")
final ServicesManager servicesManager) {
this.servicesManager = servicesManager;
}

@Override
protected Event doExecute(final RequestContext context) throws Exception {
final Service service = WebUtils.getService(context);
//No service == plain /login request. Return success indicating transition to the login form
if (service == null) {
return success();
}

if (this.servicesManager.getAllServices().isEmpty()) {
final String msg = String.format("No service definitions are found in the service manager. "
+ "Service [%s] will not be automatically authorized to request authentication.", service.getId());
logger.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_EMPTY_SVC_MGMR, msg);
}
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);

if (registeredService == null) {
final String msg = String.format("Service Management: missing service. "
+ "Service [%s] is not found in service registry.", service.getId());
logger.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
final String msg = String.format("Service Management: Unauthorized Service Access. "
+ "Service [%s] is not allowed access via the service registry.", service.getId());

logger.warn(msg);

WebUtils.putUnauthorizedRedirectUrlIntoFlowScope(context,
registeredService.getAccessStrategy().getUnauthorizedRedirectUrl());
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}

return success();
}
}
package org.apereo.cas.web.flow;

import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.services.RegisteredService;
import org.apereo.cas.services.ServicesManager;
import org.apereo.cas.services.UnauthorizedServiceException;
import org.apereo.cas.web.support.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import org.springframework.webflow.action.AbstractAction;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;

/**
* Performs a basic check if an authentication request for a provided service is authorized to proceed
* based on the registered services registry configuration (or lack thereof).
*
* @author Dmitriy Kopylenko
* @since 3.5.1
**/
@RefreshScope
@Component("serviceAuthorizationCheck")
public class ServiceAuthorizationCheck extends AbstractAction {


private ServicesManager servicesManager;

private transient Logger logger = LoggerFactory.getLogger(this.getClass());

/**
* Initialize the component with an instance of the services manager.
* @param servicesManager the service registry instance.
*/
@Autowired
public ServiceAuthorizationCheck(@Qualifier("servicesManager")
final ServicesManager servicesManager) {
this.servicesManager = servicesManager;
}

@Override
protected Event doExecute(final RequestContext context) throws Exception {
final Service service = WebUtils.getService(context);
//No service == plain /login request. Return success indicating transition to the login form
if (service == null) {
return success();
}

if (this.servicesManager.getAllServices().isEmpty()) {
final String msg = String.format("No service definitions are found in the service manager. "
+ "Service [%s] will not be automatically authorized to request authentication.", service.getId());
logger.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_EMPTY_SVC_MGMR, msg);
}
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);

if (registeredService == null) {
final String msg = String.format("Service Management: missing service. "
+ "Service [%s] is not found in service registry.", service.getId());
logger.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
final String msg = String.format("Service Management: Unauthorized Service Access. "
+ "Service [%s] is not allowed access via the service registry.", service.getId());

logger.warn(msg);

WebUtils.putUnauthorizedRedirectUrlIntoFlowScope(context,
registeredService.getAccessStrategy().getUnauthorizedRedirectUrl());
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}

return success();
}
}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 876cc8a

Please sign in to comment.