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


Java Constants类代码示例

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


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


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