当前位置: 首页>>代码示例>>Java>>正文


Java IRequestableComponent类代码示例

本文整理汇总了Java中org.apache.wicket.request.component.IRequestableComponent的典型用法代码示例。如果您正苦于以下问题:Java IRequestableComponent类的具体用法?Java IRequestableComponent怎么用?Java IRequestableComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IRequestableComponent类属于org.apache.wicket.request.component包,在下文中一共展示了IRequestableComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
    if (componentClass == CmsPage.class) {
        RequestCycle requestCycle = RequestCycle.get();
        String pageId = requestCycle.getRequest().getQueryParameters().getParameterValue("pageId").toString("");
        PageRoleTable pageRoleTable = Tables.PAGE_ROLE.as("pageRoleTable");
        RoleTable roleTable = Tables.ROLE.as("roleTable");
        DSLContext context = Spring.getBean(DSLContext.class);
        List<String> roles = context.select(roleTable.NAME).from(roleTable).innerJoin(pageRoleTable).on(roleTable.ROLE_ID.eq(pageRoleTable.ROLE_ID)).where(pageRoleTable.PAGE_ID.eq(pageId)).fetchInto(String.class);
        Roles r = new Roles();
        if (roles != null && !roles.isEmpty()) {
            r.addAll(roles);
        }
        return hasAny(r);
    } else {
        return super.isInstantiationAuthorized(componentClass);
    }
}
 
开发者ID:PkayJava,项目名称:MBaaS,代码行数:19,代码来源:AnnotationsRoleAuthorizationStrategy.java

示例2: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
	final AuthorizeInstantiationIfPermission authorizeInstantiationAnnotation =
			componentClass.getAnnotation(AuthorizeInstantiationIfPermission.class);
	if (authorizeInstantiationAnnotation != null) {
		String[] permissionNames = authorizeInstantiationAnnotation.permissions();
		for (String permissionName : permissionNames) {
			Permission permission = permissionFactory.buildFromName(permissionName);
			if (authenticationService.hasPermission(permission)) {
				return true;
			}
		}
		return false;
	}

	return true;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:18,代码来源:AnnotationsPermissionAuthorizationStrategy.java

示例3: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
	// if it's not a wicket page --> allow
	if (!Page.class.isAssignableFrom(componentClass)) {
		return true;
	}

	// if it's a page that does not require authentication --> allow
	for (Class<? extends WebPage> clazz : PAGES_WO_AUTH_REQ) {
		if (clazz.isAssignableFrom(componentClass)) {
			return true;
		}
	}

	// if it's any other wicket page and user is not logged in -->
	// redirect to login page
	if (!((UQSession) Session.get()).isAuthenticated()) {
		throw new RestartResponseAtInterceptPageException(LoginPage.class);
	}
	return true;
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:22,代码来源:UQasarRedirectWithoutLoginStrategy.java

示例4: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
/**
 * @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class)
 */
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(final Class<T> componentClass) {
	// We are authorized unless we are found not to be
	boolean authorized = true;

	// Check class annotation first because it is more specific than package
	// annotation
	final AuthorizeInstantiation classAnnotation = componentClass.getAnnotation(AuthorizeInstantiation.class);
	if (classAnnotation != null) {
		authorized = hasAny(classAnnotation.value());
	} else {
		// Check package annotation if there is no one on the the class
		final Package componentPackage = componentClass.getPackage();
		if (componentPackage != null) {
			final AuthorizeInstantiation packageAnnotation = componentPackage.getAnnotation(AuthorizeInstantiation.class);
			if (packageAnnotation != null) {
				authorized = hasAny(packageAnnotation.value());
			}
		}
	}

	return authorized;
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:27,代码来源:AnnotationBasedAuthorizationStrategy.java

示例5: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
/**
 * Uses application level meta data to match levels for component
 * instantiation.
 *
 * @see
 * org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class)
 */
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(final Class<T> componentClass) {
	if (componentClass == null) {
		throw new IllegalArgumentException("argument componentClass cannot be null");
	}

	// as long as the interface does not use generics, we should check this
	if (!Component.class.isAssignableFrom(componentClass)) {
		throw new IllegalArgumentException("argument componentClass must be of type " + Component.class.getName());
	}

	final EnumSet<Role> roles = rolesAuthorizedToInstantiate(componentClass);
	if (roles != null) {
		return hasAny(roles);
	}
	return true;
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:25,代码来源:MetaDataAuthorizationStrategy.java

示例6: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
/**
 * Uses application level meta data to match roles for component
 * instantiation.
 * 
 * @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class)
 */
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(final Class<T> componentClass) {
    if (componentClass == null) {
        throw new IllegalArgumentException("argument componentClass cannot be null");
    }

    // as long as the interface does not use generics, we should check this
    if (!Component.class.isAssignableFrom(componentClass)) {
        throw new IllegalArgumentException("argument componentClass must be of type " + Component.class.getName());
    }

    final Roles roles = rolesAuthorizedToInstantiate(componentClass);
    if (roles != null) {
        return hasAny(roles);
    }
    return true;
}
 
开发者ID:PkayJava,项目名称:pluggable,代码行数:24,代码来源:MetaDataRoleAuthorizationStrategy.java

示例7: onRequestHandlerResolved

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
@Override
public void onRequestHandlerResolved(final RequestCycle cycle,
                                     final IRequestHandler handler) {
    if (cycle.getMetaData(FIRST_HANDLER)) {
        cycle.setMetaData(FIRST_HANDLER, false);

        final StringBuilder s = new StringBuilder();

        if (handler instanceof IComponentRequestHandler) {
            final IRequestableComponent c = ((IComponentRequestHandler) handler).getComponent();
            s.append('/');
            s.append(pageClassToPath(c.getPage().getClass()));
            s.append('/');
            s.append(componentToPath(c));
        } else if (handler instanceof IPageClassRequestHandler) {
            s.append('/');
            s.append(pageClassToPath(((IPageClassRequestHandler) handler).getPageClass()));
        } else {
            NewRelic.ignoreTransaction();
            return;
        }

        NewRelic.setTransactionName(null, s.toString());
    }
}
 
开发者ID:mcievents,项目名称:newrelic-java-wicket,代码行数:26,代码来源:NewRelicRequestCycleListener.java

示例8: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(
		Class<T> componentClass) {
	if(!Page.class.isAssignableFrom(componentClass)){
		return true;
	}
	
	if(RegisterPage.class.isAssignableFrom(componentClass)){
		return true;
	}
	
	if(LogoutPage.class.isAssignableFrom(componentClass)){
		return true;
	}
	
	if(LoginPage.class.isAssignableFrom(componentClass)){
		return true;
	}
	
	@SuppressWarnings("rawtypes")
	UserSession session = (UserSession)Session.get();
	if(session.getUser().isAnonymous){
		throw new RestartResponseAtInterceptPageException(LoginPage.class);
	}
	return true;
}
 
开发者ID:atomfrede,项目名称:freezing-octo-bear,代码行数:27,代码来源:SimpleUserAuthorizationStrategy.java

示例9: setAuthorizationStrategy

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
/**
 * Initializes the authorization strategy for the web application. Pages,
 * which implement the {@link AuthenticatedWebPage} interface, are only
 * accessible for authenticated users.
 */
private void setAuthorizationStrategy() {
	this.getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy() {

		@Override
		public boolean isActionAuthorized(final Component component, final Action action) {
			// authorize everything
			return true;
		}

		@Override
		public <T extends IRequestableComponent> boolean isInstantiationAuthorized(final Class<T> componentClass) {
			// Check if the new Page requires authentication
			// (implements the marker interface)
			if (AuthenticatedWebPage.class.isAssignableFrom(componentClass)) {
				// Is user signed in?
				if (((AuthenticatedSession) Session.get()).isSignedIn()) {
					// okay to proceed
					return true;
				}

				// Intercept the request, but remember the target
				// for later.
				// Invoke Component.continueToOriginalDestination()
				// after successful logon to
				// continue with the target remembered.

				throw new RestartResponseAtInterceptPageException(LoginPage.class);
			}

			// okay to proceed
			return true;
		}
	});
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:40,代码来源:UNICORNApplication.java

示例10: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(
		Class<T> componentClass) {
	if(Page.class.isAssignableFrom(componentClass))
	{
		RequiredOrientResource[] resources = getRequiredOrientResources(componentClass);
		return resources!=null?checkResources(resources, Component.RENDER):true;
	}
	else
	{
		return true;
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:14,代码来源:OrientResourceAuthorizationStrategy.java

示例11: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
    if (!hasSpringSecuredAnnotation(componentClass)) {
        return true;
    }
    boolean authorized = isAuthorized(componentClass);
    if (Page.class.isAssignableFrom(componentClass) && !authorized) {
        String missingPermissions = ArrayUtils.toString(componentClass.getAnnotation(Secured.class).value());
        Session.get().error("Zugriff verweigert fehlende Berechtigung(en): " + missingPermissions);
        throw new RestartResponseAtInterceptPageException(LoginPage.class);
    }
    return authorized;
}
 
开发者ID:zutherb,项目名称:AppStash,代码行数:14,代码来源:SpringSecurityAuthorizationStrategy.java

示例12: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
	final RolesAllowed classAnnotation = componentClass.getAnnotation(RolesAllowed.class);
	boolean authorized = true;
	if (classAnnotation != null) {
		authorized = securityService.hasAnyRole(classAnnotation.value());
	}

	return authorized;
}
 
开发者ID:aracrown,项目名称:ara-commons,代码行数:11,代码来源:AnnotationsRoleAuthorizationStrategy.java

示例13: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
/**
 * @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class)
 */
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(final Class<T> componentClass)
{    if (WebPage.class.isAssignableFrom(componentClass) == true) {
  if (MySession.get().isAuthenticated() == true) {
    return true;
  }
  if (AbstractSecuredBasePage.class.isAssignableFrom(componentClass) == true
      || AbstractSecuredBasePage.class.isAssignableFrom(componentClass) == true
      || AbstractSecuredMobilePage.class.isAssignableFrom(componentClass) == true) {
    return false;
  }
}
return true;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:18,代码来源:MyAuthorizationStrategy.java

示例14: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(
	final Class<T> componentClass)
{
	if (!Page.class.isAssignableFrom(componentClass))
	{
		return true;
	}
	return onInstantiationAuthorized(componentClass);
}
 
开发者ID:astrapi69,项目名称:wicket.component.authorization.strategy,代码行数:14,代码来源:ComponentAuthorizationStrategy.java

示例15: isInstantiationAuthorized

import org.apache.wicket.request.component.IRequestableComponent; //导入依赖的package包/类
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
    return true;
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:4,代码来源:SpringSecurityAuthorizationStrategy.java


注:本文中的org.apache.wicket.request.component.IRequestableComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。