• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Constants类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: logout

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
public boolean logout(HttpServletRequest servletRequest)
{
    if (servletRequestMatches(servletRequest))
    {
        Session session = getSession(request, false);
        if (session != null)
        {
            session.setPrincipal(null);
            session.setAuthType(null);
            session.removeNote(Constants.SESS_USERNAME_NOTE);
            session.removeNote(Constants.SESS_PASSWORD_NOTE);
        }
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:flex-blazeds,代码行数:17,代码来源:TomcatValve.java


示例2: logout

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
public boolean logout(HttpServletRequest request)
{
    if (this.request != null && this.request.getRequest() == request)
    {
        Session session = getSession(this.request, false);
        if (session != null)
        {
            session.setPrincipal(null);
            session.setAuthType(null);
            session.removeNote(Constants.SESS_USERNAME_NOTE);
            session.removeNote(Constants.SESS_PASSWORD_NOTE);
        }
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:flex-blazeds,代码行数:17,代码来源:TomcatValve4150.java


示例3: matchRequest

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Does this request match the saved one (so that it must be the redirect
 * we signalled after successful authentication?
 *
 * @param request The request to be verified
 */
protected boolean matchRequest(Request request) {

  // Has a session been created?
  Session session = request.getSessionInternal(false);
  if (session == null)
      return (false);

  // Is there a saved request?
  SavedRequest sreq = (SavedRequest)
      session.getNote(Constants.FORM_REQUEST_NOTE);
  if (sreq == null)
      return (false);

  // Is there a saved principal?
  if (session.getNote(Constants.FORM_PRINCIPAL_NOTE) == null)
      return (false);

  // Does the request URI match?
  String requestURI = request.getRequestURI();
  if (requestURI == null)
      return (false);
  return (requestURI.equals(sreq.getRequestURI()));

}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:31,代码来源:CaGridFormAuthenticator.java


示例4: processFormLogin

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Process form login authenticator action.
 *
 * @param request The request.
 * @param response The HTTP response.
 * @param config Web-application login configuration.
 *
 * @throws IOException If an I/O error happens sending data in the response.
 */
protected void processFormLogin(final Request request,
		final HttpServletResponse response, final LoginConfig config)
	throws IOException {

	final boolean debug = this.log.isDebugEnabled();

	// get user credentials from the form
	final String loginName = request.getParameter(Constants.FORM_USERNAME);
	final String password = request.getParameter(Constants.FORM_PASSWORD);

	// validate the user in the realm
	if (debug)
		this.log.debug("form authenticating login name " + loginName);
	final Principal principal =
		this.context.getRealm().authenticate(loginName, password);

	// process authenticated user
	this.processAuthenticatedUser(request, response, config, principal,
			loginName, password, false);
}
 
开发者ID:boylesoftware,项目名称:tomcat-openidauth,代码行数:30,代码来源:OpenIDAuthenticator.java


示例5: processFormLogin

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Process form login authenticator action.
 *
 * @param request The request.
 * @param response The HTTP response.
 * @param config Web-application login configuration.
 *
 * @throws IOException If an I/O error happens sending data in the response.
 */
protected void processFormLogin(Request request,
		HttpServletResponse response, LoginConfig config)
	throws IOException {

	final boolean debug = this.log.isDebugEnabled();

	// get user credentials from the form
	final String loginName = request.getParameter(Constants.FORM_USERNAME);
	final String password = request.getParameter(Constants.FORM_PASSWORD);

	// validate the user in the realm
	if (debug)
		this.log.debug("form authenticating login name " + loginName);
	Principal principal =
		this.context.getRealm().authenticate(loginName, password);

	// process authenticated user
	this.processAuthenticatedUser(request, response, config, principal,
			loginName, password, false);
}
 
开发者ID:boylesoftware,项目名称:tomcat-openidauth,代码行数:30,代码来源:OpenIDAuthenticator.java


示例6: test09

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
@Test
public void test09() {
    // Simple SSO case
    String id = "0123456789";
    String cookie = Constants.SINGLE_SIGN_ON_COOKIE + "=" + id;
   // Assert.assertEquals(cookie, CookieFilter.filter(cookie, id));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:8,代码来源:TestCookieFilter.java


示例7: updateCredentials

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Updates the SingleSignOnEntry to reflect the latest security
 * information associated with the caller.
 *
 * @param principal the <code>Principal</code> returned by the latest
 *                  call to <code>Realm.authenticate</code>.
 * @param authType  the type of authenticator used (BASIC, CLIENT_CERT,
 *                  DIGEST or FORM)
 * @param username  the username (if any) used for the authentication
 * @param password  the password (if any) used for the authentication
 */
public void updateCredentials(Principal principal, String authType,
                              String username, String password) {

    this.principal = principal;
    this.authType = authType;
    this.username = username;
    this.password = password;
    this.canReauthenticate =
        (Constants.BASIC_METHOD.equals(authType)
            || Constants.FORM_METHOD.equals(authType));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:SingleSignOnEntry.java


示例8: getPrincipal

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Return the <code>Principal</code> associated with the given user name.
 */
protected Principal getPrincipal(String username) {

    return authenticate(username,
            new JAASCallbackHandler(this, username, null, null, null, null,
                    null, null, null, Constants.CERT_METHOD));

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:JAASRealm.java


示例9: test09

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
@Test
public void test09() {
    // Simple SSO case
    String id = "0123456789";
    String cookie = Constants.SINGLE_SIGN_ON_COOKIE + "=" + id;
    Assert.assertEquals(cookie, CookieFilter.filter(cookie, id));
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:8,代码来源:TestCookieFilter.java


示例10: redirectToAuthorizationServer

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Respond with a redirect to the OpenID Connect provider authorization
 * endpoint.
 *
 * @param request The request.
 * @param response The response.
 *
 * @throws IOException If an I/O error happens sending the response.
 */
protected void redirectToAuthorizationServer(final Request request,
		final HttpServletResponse response)
	throws IOException {

	final StringBuilder urlBuf = new StringBuilder(256);
	urlBuf.append(this.opConfig.getAuthorizationEndpoint())
		.append("?scope=")
			.append(URLEncoder.encode("openid email", UTF8.name()))
		.append("&response_type=code")
		.append("&client_id=")
			.append(URLEncoder.encode(this.clientId, UTF8.name()))
		.append("&redirect_uri=")
			.append(URLEncoder.encode(
					this.getBaseURL(request) + Constants.FORM_ACTION,
					UTF8.name()))
		.append("&state=")
			.append(URLEncoder.encode(
					request.getSessionInternal().getIdInternal(),
					UTF8.name()));
	if (this.hostedDomain != null)
		urlBuf.append("&hd=").append(
				URLEncoder.encode(this.hostedDomain, UTF8.name()));
	final String url = urlBuf.toString();

	if (this.log.isDebugEnabled())
		this.log.debug("redirecting to " + url);

	response.sendRedirect(url);
}
 
开发者ID:boylesoftware,项目名称:tomcat8-oidcauth,代码行数:39,代码来源:OpenIDConnectAuthenticator.java


示例11: login

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
public Principal login(String username, String password, HttpServletRequest servletRequest)
{
    Realm realm = container.getRealm();
    if (realm == null)
        return null;

    Principal principal = realm.authenticate(username, password);
    if (principal == null)
        return null;

    if (servletRequestMatches(servletRequest))
    {
        request.setAuthType(AUTH_TYPE);
        request.setUserPrincipal(principal);

        Session session = getSession(request, true);

        // Cache the authentication information in our session.
        if (session != null) 
        {
            session.setAuthType(AUTH_TYPE);
            session.setPrincipal(principal);

            if (username != null)
                session.setNote(Constants.SESS_USERNAME_NOTE, username);
            else
                session.removeNote(Constants.SESS_USERNAME_NOTE);

            if (password != null)
                session.setNote(Constants.SESS_PASSWORD_NOTE, password);
            else
                session.removeNote(Constants.SESS_PASSWORD_NOTE);
        }
    }

    return principal;
}
 
开发者ID:apache,项目名称:flex-blazeds,代码行数:38,代码来源:TomcatValve.java


示例12: login

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
public Principal login(String username, String password, HttpServletRequest servletRequest)
{
    Realm realm = container.getRealm();
    if (realm == null)
        return null;
    Principal principal = realm.authenticate(username, password);

    if (principal != null) 
    {
        if (this.request != null && this.request.getRequest() == servletRequest)
        {
            request.setAuthType("flexmessaging"); //was "flashgateway"
            request.setUserPrincipal(principal);

            Session session = getSession(request, true);

            // Cache the authentication information in our session, if any
            if (session != null) 
            {
                session.setAuthType("flexmessaging"); //was "flashgateway"
                session.setPrincipal(principal);
                if (username != null)
                    session.setNote(Constants.SESS_USERNAME_NOTE, username);
                else
                    session.removeNote(Constants.SESS_USERNAME_NOTE);
                if (password != null)
                    session.setNote(Constants.SESS_PASSWORD_NOTE, password);
                else
                    session.removeNote(Constants.SESS_PASSWORD_NOTE);
            }
        }
    }

    return principal;
}
 
开发者ID:apache,项目名称:flex-blazeds,代码行数:36,代码来源:TomcatValve4150.java


示例13: login

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
public Principal login(String username, String password, HttpServletRequest servletRequest)
{
    Realm realm = valve.getContainer().getRealm();
    if (realm == null)
        return null;

    Principal principal = realm.authenticate(username, password);
    if (principal == null)
        return null;

    if (servletRequestMatches(servletRequest))
    {
        request.setAuthType(AUTH_TYPE);
        request.setUserPrincipal(principal);

        Session session = getSession(request, true);

        // Cache the authentication information in our session.
        if (session != null) 
        {
            session.setAuthType(AUTH_TYPE);
            session.setPrincipal(principal);

            if (username != null)
                session.setNote(Constants.SESS_USERNAME_NOTE, username);
            else
                session.removeNote(Constants.SESS_USERNAME_NOTE);

            if (password != null)
                session.setNote(Constants.SESS_PASSWORD_NOTE, password);
            else
                session.removeNote(Constants.SESS_PASSWORD_NOTE);
        }
    }

    return principal;
}
 
开发者ID:apache,项目名称:flex-blazeds,代码行数:38,代码来源:Tomcat7Valve.java


示例14: getPrincipal

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Return the <code>Principal</code> associated with the given user name.
 */
@Override
protected Principal getPrincipal(String username) {

    return authenticate(username,
            new JAASCallbackHandler(this, username, null, null, null, null,
                    null, null, null, Constants.CERT_METHOD));

}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:12,代码来源:JAASRealm.java


示例15: savedRequestURL

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Return the request URI (with the corresponding query string, if any)
 * from the saved request so that we can redirect to it.
 *
 * @param session Our current session
 */
protected String savedRequestURL(Session session) {

    SavedRequest saved =
        (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
    if (saved == null)
        return (null);
    StringBuffer sb = new StringBuffer(saved.getRequestURI());
    if (saved.getQueryString() != null) {
        sb.append('?');
        sb.append(saved.getQueryString());
    }
    return (sb.toString());

}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:21,代码来源:CaGridFormAuthenticator.java


示例16: authenticate

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
public boolean authenticate(Request request, HttpServletResponse response,
        LoginConfig config) throws IOException {
    // set remote host value
    HostThreadLocal.set(request.getRemoteAddr());

    log.trace("Authenticating user");

    Principal principal = request.getUserPrincipal();
    if (principal != null) {
        log.trace("Already authenticated '" + principal.getName() + "'");
        return true;
    }

    Realm realm = context.getRealm();
    Session session = request.getSessionInternal(true);

    String username = getUserId(request);
    String password = getSessionCookie(request);

    // Check if there is sso id as well as sessionkey
    if (username == null || password == null) {
        log.trace("Username is null or password(sessionkey) is null:fallback to form auth");
        return super.authenticate(request, response, config);
    }
    principal = realm.authenticate(username, password);

    if (principal == null) {
        forwardToErrorPage(request, response, config);
        return false;
    }

    session.setNote(Constants.SESS_USERNAME_NOTE, username);
    session.setNote(Constants.SESS_PASSWORD_NOTE, password);
    request.setUserPrincipal(principal);

    register(request, response, principal, HttpServletRequest.FORM_AUTH, username, password);
    return true;
}
 
开发者ID:jsight,项目名称:eap-examples,代码行数:39,代码来源:GenericHeaderAuthenticator.java


示例17: logout

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
@Override
public void logout(final Request request) {

	Session session = request.getSessionInternal(false);
	if (session != null) {
		session.removeNote(Constants.FORM_PRINCIPAL_NOTE);
		session.removeNote(Constants.SESS_USERNAME_NOTE);
		session.removeNote(Constants.SESS_PASSWORD_NOTE);
		session.removeNote(OPENID_AUTH_NOTE);
	}

	super.logout(request);
}
 
开发者ID:boylesoftware,项目名称:tomcat-openidauth,代码行数:14,代码来源:OpenIDAuthenticator.java


示例18: processOriginalRequestResubmission

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Process re-submission of the original request after successful
 * authentication.
 *
 * @param request The request.
 * @param response The HTTP response.
 *
 * @throws IOException If an I/O error happens sending data in the response.
 */
protected void processOriginalRequestResubmission(final Request request,
		final HttpServletResponse response)
	throws IOException {

	// get the session
	final Session session = request.getSessionInternal(true);

	// get authenticated principal from the session and register it
	final Principal principal =
		(Principal) session.getNote(Constants.FORM_PRINCIPAL_NOTE);
	this.register(request, response, principal, this.getAuthMethod(),
			(String) session.getNote(Constants.SESS_USERNAME_NOTE),
			(String) session.getNote(Constants.SESS_PASSWORD_NOTE));

	// remove unused attributes from the session
	session.removeNote(Constants.FORM_PRINCIPAL_NOTE);
	if (this.cache) {
		session.removeNote(Constants.SESS_USERNAME_NOTE);
		session.removeNote(Constants.SESS_PASSWORD_NOTE);
		session.removeNote(OPENID_AUTH_NOTE);
	}

	// restore the original request context
	if (this.log.isDebugEnabled())
		this.log.debug("restoring original request context");
	this.restoreRequest(request, session);
}
 
开发者ID:boylesoftware,项目名称:tomcat-openidauth,代码行数:37,代码来源:OpenIDAuthenticator.java


示例19: logout

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
@Override
public void logout(Request request)
	throws ServletException {

	Session session = request.getSessionInternal(false);
	if (session != null) {
		session.removeNote(Constants.FORM_PRINCIPAL_NOTE);
		session.removeNote(Constants.SESS_USERNAME_NOTE);
		session.removeNote(Constants.SESS_PASSWORD_NOTE);
		session.removeNote(OPENID_AUTH_NOTE);
	}

	super.logout(request);
}
 
开发者ID:boylesoftware,项目名称:tomcat-openidauth,代码行数:15,代码来源:OpenIDAuthenticator.java


示例20: processOriginalRequestResubmission

import org.apache.catalina.authenticator.Constants; //导入依赖的package包/类
/**
 * Process re-submission of the original request after successful
 * authentication.
 *
 * @param request The request.
 * @param response The HTTP response.
 *
 * @throws IOException If an I/O error happens sending data in the response.
 */
protected void processOriginalRequestResubmission(Request request,
		HttpServletResponse response)
	throws IOException {

	// get the session
	Session session = request.getSessionInternal(true);

	// get authenticated principal from the session and register it
	Principal principal =
		(Principal) session.getNote(Constants.FORM_PRINCIPAL_NOTE);
	this.register(request, response, principal, this.getAuthMethod(),
			(String) session.getNote(Constants.SESS_USERNAME_NOTE),
			(String) session.getNote(Constants.SESS_PASSWORD_NOTE));

	// remove unused attributes from the session
	session.removeNote(Constants.FORM_PRINCIPAL_NOTE);
	if (this.cache) {
		session.removeNote(Constants.SESS_USERNAME_NOTE);
		session.removeNote(Constants.SESS_PASSWORD_NOTE);
		session.removeNote(OPENID_AUTH_NOTE);
	}

	// restore the original request context
	if (this.log.isDebugEnabled())
		this.log.debug("restoring original request context");
	this.restoreRequest(request, session);
}
 
开发者ID:boylesoftware,项目名称:tomcat-openidauth,代码行数:37,代码来源:OpenIDAuthenticator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReflectiveCallable类代码示例发布时间:2022-05-21
下一篇:
Java MultivariateMatrixFunction类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap