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


Java IAuthorizationStrategy类代码示例

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


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

示例1: setAuthorizationStrategy

import org.apache.wicket.authorization.IAuthorizationStrategy; //导入依赖的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

示例2: getAuthorizationStrategy

import org.apache.wicket.authorization.IAuthorizationStrategy; //导入依赖的package包/类
public CompoundAuthorizationStrategy getAuthorizationStrategy() {
    IAuthorizationStrategy authorizationStrategy = getSecuritySettings().getAuthorizationStrategy();
    if (!(authorizationStrategy instanceof CompoundAuthorizationStrategy)) {
        throw new IllegalStateException(
                "Unexpected authorization strategy: " + authorizationStrategy.getClass());
    }
    return (CompoundAuthorizationStrategy) authorizationStrategy;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:9,代码来源:ArtifactoryApplication.java

示例3: addSecurityAuthorization

import org.apache.wicket.authorization.IAuthorizationStrategy; //导入依赖的package包/类
protected void addSecurityAuthorization() {
	Class<? extends Page> signInPageClass = LoginPage.class;
	if (CasUtil.isCasUsed()) {
		signInPageClass = CasLoginPage.class;
	}

	IAuthorizationStrategy authStrategy = new SimplePageAuthorizationStrategy(SecurePage.class, signInPageClass) {

		@Override
		protected boolean isAuthorized() {
			boolean b = NextServerSession.get().isSignedIn();
			if (!b) {
				if (CasUtil.isCasUsed()) {
					LOG.debug("Checking if context contains CAS authentication");
					b = NextServerSession.get().checkForSignIn();
					if (!b) {
						String serviceUrl = CasUtil.getServiceProperties().getService();
						String loginUrl = CasUtil.getLoginUrl();
						LOG.debug("cas authentication: service URL: " + serviceUrl);
						String redirectUrl = loginUrl + "?service=" + serviceUrl;
						LOG.debug("attempting to redirect to: " + redirectUrl);
						throw new RestartResponseAtInterceptPageException(new RedirectPage(redirectUrl));
					}
				}
			}

			return b;
		}

	};
	getSecuritySettings().setAuthorizationStrategy(authStrategy);
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:33,代码来源:NextServerApplication.java

示例4: getAuthorizationStrategy

import org.apache.wicket.authorization.IAuthorizationStrategy; //导入依赖的package包/类
protected IAuthorizationStrategy getAuthorizationStrategy() {
    return Application.get().getSecuritySettings().getAuthorizationStrategy();
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:4,代码来源:MenuNode.java

示例5: getAuthorizationStrategy

import org.apache.wicket.authorization.IAuthorizationStrategy; //导入依赖的package包/类
@Override
public IAuthorizationStrategy getAuthorizationStrategy() {
  return new OntopolyAuthorizationStrategy();
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:5,代码来源:OntopolySession.java


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