类javax.naming.ldap.ExtendedResponse源码实例Demo

下面列出了怎么用javax.naming.ldap.ExtendedResponse的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: ldapchai   文件: AbstractProvider.java
public final ExtendedResponse extendedOperation( final ExtendedRequest request )
{
    if ( request == null )
    {
        throw new NullPointerException( "request must not be null" );
    }

    return null;
}
 
源代码2 项目: ldapchai   文件: JNDIProviderImpl.java
@LdapOperation
@ModifyOperation
public final ExtendedResponse extendedOperation( final ExtendedRequest request )
        throws ChaiUnavailableException, ChaiOperationException

{
    activityPreCheck();

    getInputValidator().extendedOperation( request );

    preCheckExtendedOperation( request );

    final LdapContext ldapConnection = getLdapConnection();
    try
    {
        return ldapConnection.extendedOperation( request );
    }
    catch ( NamingException e )
    {
        cacheExtendedOperationException( request, e );

        // guaranteedb to throw ChaiException
        convertNamingException( e );
    }

    return null;
}
 
源代码3 项目: ldapchai   文件: InetOrgPersonImpl.java
public boolean testPasswordPolicy( final String password )
        throws ChaiUnavailableException, ChaiPasswordPolicyException
{
    final boolean useNmasSetting = this.getChaiProvider().getChaiConfiguration().getBooleanSetting( ChaiSetting.EDIRECTORY_ENABLE_NMAS );
    if ( !useNmasSetting )
    {
        return true;
    }

    final PwdPolicyCheckRequest request = new PwdPolicyCheckRequest();
    request.setData( password );
    request.setObjectDN( this.getEntryDN() );
    final ExtendedResponse response;
    try
    {
        response = getChaiProvider().extendedOperation( request );
    }
    catch ( ChaiOperationException e )
    {
        LOGGER.debug( "unexpected error while checking [nmas] password policy: " + e.getMessage() );
        return true;
    }
    if ( response != null )
    {
        final PwdPolicyCheckResponse setResponse = ( PwdPolicyCheckResponse ) response;
        final int responseCode = setResponse.getNmasRetCode();
        if ( responseCode != 0 )
        {
            LOGGER.debug( "nmas response code returned from server while testing nmas password: " + responseCode );
            final String errorString = "nmas error " + responseCode;
            throw new ChaiPasswordPolicyException( errorString, ChaiErrors.getErrorForMessage( errorString ) );
        }
    }
    return true;
}
 
源代码4 项目: ldapchai   文件: InetOrgPersonImpl.java
public final String readPassword()
        throws ChaiUnavailableException, ChaiOperationException
{
    final boolean useNmasSetting = this.getChaiProvider().getChaiConfiguration().getBooleanSetting( ChaiSetting.EDIRECTORY_ENABLE_NMAS );
    if ( !useNmasSetting )
    {
        throw new UnsupportedOperationException( "readPassword() is not supported when ChaiSetting.EDIRECTORY_ENABLE_NMAS is false" );
    }

    final GetPwdRequest request = new GetPwdRequest( "", this.getEntryDN() );
    final ExtendedResponse response;
    response = getChaiProvider().extendedOperation( request );
    if ( response != null )
    {
        final GetPwdResponse getResponse = ( GetPwdResponse ) response;
        final int responseCode = getResponse.getNmasRetCode();
        switch ( responseCode )
        {
            // Success
            case 0:
                return getResponse.getPwdStr();

            // NMAS_E_ENTRY_ATTRIBUTE_NOT_FOUND
            case ( -16049 ):
                LOGGER.debug( "readPassword() reports: NMAS_E_ENTRY_ATTRIBUTE_NOT_FOUND " + responseCode );
                throw new ChaiOperationException( "object has no password attribute: error " + responseCode, ChaiError.NO_SUCH_ATTRIBUTE );

            default:
                LOGGER.debug( "error testing nmas password: " + responseCode );
                throw new ChaiOperationException( "error reading nmas password: error " + responseCode, ChaiError.UNKNOWN );
        }
    }

    LOGGER.debug( "unknown error retrieving password (null response)" );
    throw new ChaiOperationException( "unknown error retrieving password (null response)", ChaiError.UNKNOWN );
}
 
源代码5 项目: james-project   文件: RetryingLdapContext.java
@Override
public ExtendedResponse extendedOperation(final ExtendedRequest request) throws NamingException {
    return (ExtendedResponse) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
            @Override
            public Object operation() throws NamingException {
                return ((LdapContext) getDelegate()).extendedOperation(request);
            }
        }.perform();
}
 
源代码6 项目: micro-integrator   文件: LdapContextWrapper.java
@Override
public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException {

    return ldapContext.extendedOperation(request);
}
 
public ExtendedResponse extendedOperation(ExtendedRequest extendedRequest)
        throws NamingException {
    return getLdapContext().extendedOperation(extendedRequest);
}
 
源代码8 项目: quarkus   文件: DelegatingLdapContext.java
@Override
public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException {
    if (!(delegating instanceof LdapContext))
        throw Assert.unsupported();
    return ((LdapContext) delegating).extendedOperation(request);
}
 
源代码9 项目: directory-ldap-api   文件: JavaStoredProcUtils.java
/**
 * Invoke a Stored Procedure
 *
 * @param ctx The execution context
 * @param procedureName The procedure to execute
 * @param arguments The procedure's arguments
 * @return The execution resut
 * @throws NamingException If we have had an error whil executing the stored procedure
 */
public static Object callStoredProcedure( LdapContext ctx, String procedureName, Object[] arguments )
    throws NamingException
{
    String language = "Java";

    Object responseObject;
    try
    {
        /**
         * Create a new stored procedure execution request.
         */
        StoredProcedureRequestImpl req = new StoredProcedureRequestImpl( 0, procedureName, language );

        /**
         * For each argument UTF-8-encode the type name
         * and Java-serialize the value
         * and add them to the request as a parameter object.
         */
        for ( int i = 0; i < arguments.length; i++ )
        {
            byte[] type;
            byte[] value;
            type = arguments[i].getClass().getName().getBytes( StandardCharsets.UTF_8 );
            value = SerializationUtils.serialize( ( Serializable ) arguments[i] );
            req.addParameter( type, value );
        }

        /**
         * Call the stored procedure via the extended operation
         * and get back its return value.
         */
        ExtendedRequest jndiReq = LdapApiServiceFactory.getSingleton().toJndi( req );
        ExtendedResponse resp = ctx.extendedOperation( jndiReq );

        /**
         * Restore a Java object from the return value.
         */
        byte[] responseStream = resp.getEncodedValue();
        responseObject = SerializationUtils.deserialize( responseStream );
    }
    catch ( Exception e )
    {
        NamingException ne = new NamingException();
        ne.setRootCause( e );
        throw ne;
    }

    return responseObject;
}
 
源代码10 项目: ldapchai   文件: WatchdogWrapper.java
@Override
public ExtendedResponse extendedOperation( final ExtendedRequest request )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException
{
    return providerHolder.execute( chaiProvider -> chaiProvider.extendedOperation( request ) );
}
 
源代码11 项目: entando-components   文件: InitialLdapContext.java
@Override
public ExtendedResponse extendedOperation(ExtendedRequest er) throws NamingException {
	ExtendedResponse extResponse = super.extendedOperation(er);
	this.setExtendedResponse(extResponse);
	return extResponse;
}
 
源代码12 项目: entando-components   文件: InitialLdapContext.java
protected ExtendedResponse getExtendedResponse() {
	return _extendedResponse;
}
 
源代码13 项目: entando-components   文件: InitialLdapContext.java
protected void setExtendedResponse(ExtendedResponse extendedResponse) {
	this._extendedResponse = extendedResponse;
}
 
源代码14 项目: keycloak   文件: PasswordModifyRequest.java
@Override
public ExtendedResponse createExtendedResponse(String id, byte[] berValue, int offset, int length) {
  return null;
}
 
源代码15 项目: spring-ldap   文件: DelegatingLdapContext.java
/**
 * @see javax.naming.ldap.LdapContext#extendedOperation(javax.naming.ldap.ExtendedRequest)
 */
public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException {
    this.assertOpen();
    return this.getDelegateLdapContext().extendedOperation(request);
}
 
源代码16 项目: spring-ldap   文件: DelegatingLdapContext.java
/**
 * @see LdapContext#extendedOperation(ExtendedRequest)
 */
public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException {
    this.assertOpen();
    return this.getDelegateLdapContext().extendedOperation(request);
}
 
源代码17 项目: ldapchai   文件: OpenLDAPModifyPasswordRequest.java
/**
 * Creates the extended response.  With OpenLDAP, the extended
 * operation for Password modification doesn't create a
 * response so we just return null here.
 *
 * @param id       the OID of the response
 * @param berValue the BER encoded value of the response
 * @param offset   the offset
 * @param length   the length of the response
 * @return returns null as the modify password operation doesn't
 *     generate a response.
 */
public ExtendedResponse createExtendedResponse(
        final String id,
        final byte[] berValue,
        final int offset,
        final int length )
{
    return null;
}
 
源代码18 项目: ldapchai   文件: ChaiProvider.java
/**
 * Performs an extended operation against the server.  The extended operation must be understood by the server.
 *
 * @param request An ExtendedRequest bean that can be
 * @return An ExtendedResponse created in response to the request.
 * @throws ChaiOperationException   If an error is encountered during the operation
 * @throws ChaiUnavailableException If no directory servers are reachable
 * @throws IllegalStateException    If the underlying connection is not in an available state
 * @see ExtendedRequest
 * @see ExtendedResponse
 */
@ChaiProvider.LdapOperation
@ChaiProvider.ModifyOperation
ExtendedResponse extendedOperation( ExtendedRequest request )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException;
 
 类所在包
 类方法
 同包方法