private DigestCredential getDigestCredential() { ObjectCallback oc = new ObjectCallback("Credential:"); try { super.callbackHandler.handle(new Callback[] { oc }); } catch (IOException | UnsupportedCallbackException e) { return null; } Object credential = oc.getCredential(); if (credential instanceof DigestCredential) { return (DigestCredential) credential; } return null; }
public JASPICSecurityContext(final HttpServerExchange exchange, final AuthenticationMode mode, final IdentityManager identityManager, final String securityDomain) { super (exchange, mode, identityManager); this.exchange = exchange; this.manager = new JASPIServerAuthenticationManager(securityDomain, new JBossCallbackHandler()); }
@Override public Account verify(String id, Credential credential) { AccountImpl account = getAccount(id); if (credential instanceof DigestCredential) { DigestCredential digestCredential = (DigestCredential) credential; DigestCallbackHandler handler = new DigestCallbackHandler(id, digestCredential.getNonce(), digestCredential.getNonceCount(), digestCredential.getClientNonce(), digestCredential.getQop(), digestCredential.getRealm(), digestCredential.getHA2()); CallbackHandlerPolicyContextHandler.setCallbackHandler(handler); return verifyCredential(account, digestCredential.getClientDigest()); } else if(credential instanceof PasswordCredential) { final char[] password = ((PasswordCredential) credential).getPassword(); // The original array may be cleared, this integration relies on it being cached for use later. final char[] duplicate = Arrays.copyOf(password, password.length); return verifyCredential(account, duplicate); } else { return verifyCredential(account, credential); } }
SecurityAssociationCallback callback = new SecurityAssociationCallback(); Callback[] callbacks = {callback}; final String username; try { callbackHandler.handle(callbacks); username = callback.getPrincipal().getName(); final Object c = callback.getCredential(); if (c instanceof SASCurrent) { credential = (SASCurrent) c;
protected void verifyPassword( VerifyPasswordCallback vpc) throws NamingException { String credential = vpc.getValue(); ClassLoader currentTCCL = SecurityActions.getContextClassLoader(); if (currentTCCL != null) SecurityActions.setContextClassLoader(null); String baseDN = options.get(BASE_CTX_DN); String baseFilter = options.get(BASE_FILTER_OPT); InitialLdapContext ctx= this.constructInitialLdapContext(bindDN, bindCredential); bindDNAuthentication(ctx, userName, credential, baseDN, baseFilter); vpc.setVerified(true); }
CallbackHandlerPolicyContextHandler chandler = new CallbackHandlerPolicyContextHandler(); PolicyContext.registerHandler(SecurityConstants.CALLBACK_HANDLER_KEY, chandler, true);
private synchronized void buildGoogleApiClient() { mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(new MapCallback()) .addOnConnectionFailedListener(new FailedCallback()) .addApi(LocationServices.API) .build(); }
final GenericMessageInfo messageInfo = createMessageInfo(exchange, sc); final String applicationIdentifier = buildApplicationIdentifier(requestContext); final JASPICallbackHandler cbh = new JASPICallbackHandler(); exchange.putAttachment(JASPICContext.ATTACHMENT_KEY, new JASPICContext(messageInfo, sam, cbh)); UndertowLogger.ROOT_LOGGER.debugf("validateRequest for layer [%s] and applicationContextIdentifier [%s]", JASPI_HTTP_SERVLET_LAYER, applicationIdentifier);
static CallbackHandler getContextCallbackHandler() throws Exception { if(System.getSecurityManager() == null) { return PolicyContextActions.NON_PRIVILEGED.getContextCallbackHandler(); } else { return PolicyContextActions.PRIVILEGED.getContextCallbackHandler(); } }
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if(userName == null) { userName = getUserName(callbacks); } for (int i = 0; i < callbacks.length; i++) { Callback callback = callbacks[i]; this.handleCallBack( callback ); } }
public String getInfoDigest(MessageDigest digest) { if (rfc2617 == null) { byte[] data = digest.digest(); rfc2617 = cvtHex(data); } return rfc2617; }
protected Object getCredential() throws LoginException { NameCallback nc = new NameCallback("Alias: "); ObjectCallback oc = new ObjectCallback("Credential: "); Callback[] callbacks = { nc, oc }; try { callbackHandler.handle(callbacks); return oc.getCredential(); } catch (IOException ioe) { LoginException le = new LoginException(); le.initCause(ioe); throw le; } catch (UnsupportedCallbackException uce) { LoginException le = new LoginException(); le.initCause(uce); throw le; } }
private JASPIServerAuthenticationManager createJASPIAuthenticationManager() { return new JASPIServerAuthenticationManager(this.securityDomain, new JBossCallbackHandler()); }
public void init(Map<String,Object> options) { // Ask for MapCallback to obtain the digest parameters info = new MapCallback(); Callback[] callbacks = {info}; options.put("callbacks", callbacks); }
static CallbackHandler getContextCallbackHandler() throws PolicyContextException { if(System.getSecurityManager() == null) { return PolicyContextActions.NON_PRIVILEGED.getContextCallbackHandler(); } else { return PolicyContextActions.PRIVILEGED.getContextCallbackHandler(); } }
/** Creates a default JaasSecurityManager for with a securityDomain name of 'other'. */ public JaasSecurityManagerBase() { this("other", new JBossCallbackHandler()); } /** Creates a JaasSecurityManager for with a securityDomain
/** Creates a default JaasSecurityManager for with a securityDomain name of 'other'. */ public SynchronizedJaasSecurityManager() { this("other", new JBossCallbackHandler()); }
/** Creates a default JaasSecurityManager for with a securityDomain name of 'other'. */ public JaasSecurityManagerBase() { this(SecurityConstants.DEFAULT_APPLICATION_POLICY, new JBossCallbackHandler()); } /** Creates a JaasSecurityManager for with a securityDomain
public JASPICSecurityContext(final HttpServerExchange exchange, final AuthenticationMode mode, final IdentityManager identityManager, final String securityDomain) { super (exchange, mode, identityManager); this.exchange = exchange; this.manager = new JASPIServerAuthenticationManager(securityDomain, new JBossCallbackHandler()); }
public JASPICSecurityContext(final HttpServerExchange exchange, final AuthenticationMode mode, final IdentityManager identityManager, final String securityDomain) { super (exchange, mode, identityManager); this.exchange = exchange; this.manager = new JASPIServerAuthenticationManager(securityDomain, new JBossCallbackHandler()); }