Codota Logo
AuthorizationPolicy.getPassword
Code IndexAdd Codota to your IDE (free)

How to use
getPassword
method
in
org.apache.cxf.configuration.security.AuthorizationPolicy

Best Java code snippets using org.apache.cxf.configuration.security.AuthorizationPolicy.getPassword (Showing top 20 results out of 315)

  • Common ways to obtain AuthorizationPolicy
private void myMethod () {
AuthorizationPolicy a =
  • Codota Iconnew AuthorizationPolicy()
  • Codota IconMessage message;message.get(AuthorizationPolicy.class)
  • Codota IconHTTPConduit hTTPConduit;hTTPConduit.getAuthorization()
  • Smart code suggestions by Codota
}
origin: org.apache.cxf/cxf-rt-transports-http

public String getAuthorization(AuthorizationPolicy  authPolicy,
                URI currentURI,
                Message message,
                String fullHeader) {
  if (authPolicy.getUserName() != null && authPolicy.getPassword() != null) {
    boolean encodeBasicAuthWithIso8859 = PropertyUtils.isTrue(
      message.getContextualProperty(ENCODE_BASIC_AUTH_WITH_ISO8859));
    return getBasicAuthHeader(authPolicy.getUserName(),
                 authPolicy.getPassword(),
                 encodeBasicAuthWithIso8859);
  }
  return null;
}
origin: org.apache.cxf/cxf-rt-transports-http

              Message message,
              String fullHeader) {
if (authPolicy == null || (authPolicy.getUserName() == null && authPolicy.getPassword() == null)) {
  return null;
                authPolicy.getPassword());
                authPolicy.getPassword());
origin: org.apache.cxf/cxf-rt-frontend-jaxws

    message.put(AuthorizationPolicy.class.getName(), authPolicy);
  ret = authPolicy.getPassword();
  authPolicy.setPassword((String)value);
} else if (MessageContext.HTTP_REQUEST_HEADERS.equals(key)) {
origin: org.apache.cxf/cxf-rt-transports-http

&& StringUtils.isEmpty(contextName) && loginConfig == null)) {
CallbackHandler callbackHandler = getUsernamePasswordHandler(
  authPolicy.getUserName(), authPolicy.getPassword());
LoginContext lc = new LoginContext(contextName, null, callbackHandler, loginConfig);
lc.login();
origin: org.apache.cxf/cxf-rt-transports-http

String pwd = httpConduit.getAuthorization().getPassword();
if (un != null && pwd != null) {
  auth = new PasswordAuthentication(un, pwd.toCharArray());
origin: org.apache.cxf/cxf-rt-frontend-jaxws

  (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
if (authPolicy != null) {
  ret = authPolicy.getPassword();
origin: org.apache.cxf/cxf-rt-transports-http

public void handleMessage(Message message) throws Fault {
  String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
  String query = (String)message.get(Message.QUERY_STRING);
  if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
    return;
  }
  Endpoint endpoint = message.getExchange().getEndpoint();
  synchronized (endpoint) {
    if (!StringUtils.isEmpty(contextName)) {
      AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
      if (policy == null) {
        handle401response(message, endpoint);
        return;
      }
      Subject subject = (Subject)authenticate(policy.getUserName(), policy.getPassword());
      if (subject == null) {
        handle401response(message, endpoint);
        return;
      }
    }
  }
}
origin: stackoverflow.com

AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
 if (policy == null) {
   sendErrorResponse(message, HttpURLConnection.HTTP_UNAUTHORIZED);
   return;
 }
 message.put("request_usr", policy.getUserName());
 message.put("request_pwd", policy.getPassword());
origin: org.apache.cxf/cxf-bundle-jaxrs

public String getAuthorization(AuthorizationPolicy  authPolicy,
                URI currentURI,
                Message message,
                String fullHeader) {
  if (authPolicy.getUserName() != null && authPolicy.getPassword() != null) {
    return getBasicAuthHeader(authPolicy.getUserName(), 
                 authPolicy.getPassword());
  } else {
    return null;
  }
}
origin: Evolveum/midpoint

@Override
protected PasswordAuthenticationContext createAuthenticationContext(AuthorizationPolicy policy, ContainerRequestContext requestCtx){
  return new PasswordAuthenticationContext(policy.getUserName(), policy.getPassword());
}
origin: apache/cxf

public String getAuthorization(AuthorizationPolicy  authPolicy,
                URI currentURI,
                Message message,
                String fullHeader) {
  if (authPolicy.getUserName() != null && authPolicy.getPassword() != null) {
    boolean encodeBasicAuthWithIso8859 = PropertyUtils.isTrue(
      message.getContextualProperty(ENCODE_BASIC_AUTH_WITH_ISO8859));
    return getBasicAuthHeader(authPolicy.getUserName(),
                 authPolicy.getPassword(),
                 encodeBasicAuthWithIso8859);
  }
  return null;
}
origin: apache/cxf

@Override
public CallbackHandler create(Message message) {
  AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
  if (policy == null) {
    return null;
  }
  return new NamePasswordCallbackHandler(policy.getUserName(), policy.getPassword());
}
origin: org.apache.cxf/cxf-core

@Override
public CallbackHandler create(Message message) {
  AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
  if (policy == null) {
    return null;
  }
  return new NamePasswordCallbackHandler(policy.getUserName(), policy.getPassword());
}
origin: stackoverflow.com

public void handleMessage(Message message) throws Fault {
   String requestURI = message.get(Message.REQUEST_URI).toString();
   String methodKeyword = requestURI.substring("localhost".length()+1).split("/")[0];
   if(methodKeyword.equals("open")) {
     AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
     if(policy == null) {
       Fault fault = new Fault("incorrect username or password", Logger.getGlobal());
       fault.setStatusCode(401);
       throw fault;
     }
     String realPassword = userPasswords.get(policy.getUserName());
     if (realPassword == null || !realPassword.equals(policy.getPassword())) {
       Fault fault = new Fault("incorrect username or password", Logger.getGlobal());
       fault.setStatusCode(403);
       throw fault;
     }
   }
 }
origin: apache/cxf

protected UsernameToken convertPolicyToToken(AuthorizationPolicy policy) {
  Document doc = DOMUtils.getEmptyDocument();
  UsernameToken token = new UsernameToken(false, doc,
                      WSS4JConstants.PASSWORD_TEXT);
  token.setName(policy.getUserName());
  token.setPassword(policy.getPassword());
  return token;
}
origin: apache/cxf

public void handleMessage(Message message) throws Fault {
  AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
  if (policy == null || policy.getUserName() == null || policy.getPassword() == null) {
    String name = null;
    if (policy != null) {
      name = policy.getUserName();
    }
    org.apache.cxf.common.i18n.Message errorMsg =
      new org.apache.cxf.common.i18n.Message("NO_USER_PASSWORD",
                          BUNDLE,
                          name);
    LOG.warning(errorMsg.toString());
    throw new SecurityException(errorMsg.toString());
  }
  try {
    super.validate(message);
  } catch (Exception ex) {
    throw new Fault(ex);
  }
}
origin: org.apache.cxf/cxf-rt-ws-security

public void handleMessage(Message message) throws Fault {
  AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
  if (policy == null || policy.getUserName() == null || policy.getPassword() == null) {
    String name = null;
    if (policy != null) {
      name = policy.getUserName();
    }
    org.apache.cxf.common.i18n.Message errorMsg =
      new org.apache.cxf.common.i18n.Message("NO_USER_PASSWORD",
                          BUNDLE,
                          name);
    LOG.warning(errorMsg.toString());
    throw new SecurityException(errorMsg.toString());
  }
  try {
    super.validate(message);
  } catch (Exception ex) {
    throw new Fault(ex);
  }
}
origin: apache/cxf

public void filter(ContainerRequestContext requestContext) throws IOException {
  Message message = JAXRSUtils.getCurrentMessage();
  AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
  if (policy == null || policy.getUserName() == null || policy.getPassword() == null) {
    requestContext.abortWith(
      Response.status(401).header("WWW-Authenticate", "Basic realm=\"IdP\"").build());
    return;
  }
  try {
    super.validate(message);
  } catch (Exception ex) {
    throw ExceptionUtils.toInternalServerErrorException(ex, null);
  }
}
origin: apache/cxf

@Override
public void filter(ClientRequestContext requestContext) throws IOException {
  JwtToken jwt = getJwtToken(requestContext);
  if (jwt == null && super.isJweRequired()) {
    AuthorizationPolicy ap = JAXRSUtils.getCurrentMessage().getExchange()
      .getEndpoint().getEndpointInfo().getExtensor(AuthorizationPolicy.class);
    if (ap != null && ap.getUserName() != null) {
      JwtClaims claims = new JwtClaims();
      claims.setSubject(ap.getUserName());
      claims.setClaim("password", ap.getPassword());
      claims.setIssuedAt(System.currentTimeMillis() / 1000L);
      jwt = new JwtToken(new JweHeaders(), claims);
    }
  }
  if (jwt == null) {
    throw new JoseException("JWT token is not available");
  }
  String data = super.processJwt(jwt);
  requestContext.getHeaders().putSingle(HttpHeaders.AUTHORIZATION,
                     authScheme + " " + data);
}
origin: org.apache.cxf/cxf-rt-transports-websocket

private synchronized AsyncHttpClient getAsyncHttpClient(Message message) {
  if (ahcclient == null) {
    DefaultAsyncHttpClientConfig.Builder builder = new DefaultAsyncHttpClientConfig.Builder();
    AuthorizationPolicy ap = getEffectiveAuthPolicy(message);
    if (ap != null
      && (!StringUtils.isEmpty(ap.getAuthorizationType())
        || !StringUtils.isEmpty(ap.getUserName()))) {
      Realm.Builder rb = new Realm.Builder(ap.getUserName(), ap.getPassword());
      if (ap.getAuthorizationType() == null) {
        rb.setScheme(AuthScheme.BASIC);
      } else {
        rb.setScheme(AuthScheme.valueOf(ap.getAuthorizationType().toUpperCase()));
      }
      rb.setUsePreemptiveAuth(true);
      builder.setRealm(rb.build());
    }
    AsyncHttpClientConfig config = builder.build();
    ahcclient = new DefaultAsyncHttpClient(config);
  }
  return ahcclient;
}
org.apache.cxf.configuration.securityAuthorizationPolicygetPassword

Javadoc

Gets the value of the password property.

Password for server BASIC authentication login (some servers require users to authenticate with the server -- see also UserName, AuthorizationType, and Authorization)

Popular methods of AuthorizationPolicy

  • getUserName
    Gets the value of the userName property.
  • <init>
  • setUserName
    Sets the value of the userName property.
  • setPassword
    Sets the value of the password property.
  • setAuthorizationType
    Sets the value of the authorizationType property.
  • setAuthorization
    Sets the value of the authorization property.
  • getAuthorizationType
    Gets the value of the authorizationType property.
  • getAuthorization
    Gets the value of the authorization property.

Popular in Java

  • Finding current android device location
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now