Package com.unboundid.ldap.sdk
Class OAUTHBEARERBindRequest
java.lang.Object
com.unboundid.ldap.sdk.LDAPRequest
com.unboundid.ldap.sdk.BindRequest
com.unboundid.ldap.sdk.SASLBindRequest
com.unboundid.ldap.sdk.OAUTHBEARERBindRequest
- All Implemented Interfaces:
ReadOnlyLDAPRequest,Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class OAUTHBEARERBindRequest
extends SASLBindRequest
This class provides an implementation of a SASL bind request that uses the
OAUTHBEARER SASL mechanism described in
RFC 7628 to allow a user
to authenticate with an OAuth 2.0 bearer token.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name for the OAUTHBEARER SASL mechanism.Fields inherited from class com.unboundid.ldap.sdk.SASLBindRequest
CRED_TYPE_SASLFields inherited from class com.unboundid.ldap.sdk.BindRequest
VERSION_ELEMENT -
Constructor Summary
ConstructorsConstructorDescriptionOAUTHBEARERBindRequest(OAUTHBEARERBindRequestProperties properties, Control... controls) Creates a new OAUTHBEARER bind request with the provided set of properties.OAUTHBEARERBindRequest(String accessToken, Control... controls) Creates a new OAUTHBEARER bind request with the provided access token. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance of this LDAP request that may be modified without impacting this request.Creates a new instance of this LDAP request that may be modified without impacting this request.Retrieves the access token to include in the bind request.Retrieves an unmodifiable map of additional key-value pairs that should be included in the bind request.Retrieves the authorization ID to include in the GS2 header for the bind request, if any.intRetrieves the message ID for the last LDAP message sent using this request.Retrieves the method to use for HTTP-based requests, if any.Retrieves the path to use for HTTP-based requests, if any.Retrieves the data to submit when posting an HTTP-based request, if any.Retrieves the query string to use for HTTP-based requests, if any.Retrieves the name of the SASL mechanism used in this SASL bind request.Retrieves the server address to include in the bind request, if any.Retrieves the server port to include in the bind request, if any.protected OAUTHBEARERBindResultprocess(LDAPConnection connection, int depth) Sends this bind request to the target server over the provided connection and returns the corresponding response.voidAppends a number of lines comprising the Java source code that can be used to recreate this request to the given list.toString()Retrieves a string representation of the OAUTHBEARER bind request.voidtoString(StringBuilder buffer) Appends a string representation of the OAUTHBEARER bind request to the provided buffer.Methods inherited from class com.unboundid.ldap.sdk.SASLBindRequest
getBindType, responseReceived, sendBindRequest, sendMessageMethods inherited from class com.unboundid.ldap.sdk.BindRequest
getOperationType, getRebindRequestMethods inherited from class com.unboundid.ldap.sdk.LDAPRequest
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getReferralConnector, getReferralConnectorInternal, getReferralDepth, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setReferralConnector, setReferralDepth, setResponseTimeoutMillis
-
Field Details
-
OAUTHBEARER_MECHANISM_NAME
The name for the OAUTHBEARER SASL mechanism.- See Also:
-
-
Constructor Details
-
OAUTHBEARERBindRequest
Creates a new OAUTHBEARER bind request with the provided access token. All other properties will be unset.- Parameters:
accessToken- The access token to use for this bind request. It must not benullor empty.controls- The set of controls to include in the bind request. It may benullor empty if no controls are needed.
-
OAUTHBEARERBindRequest
public OAUTHBEARERBindRequest(@NotNull OAUTHBEARERBindRequestProperties properties, @Nullable Control... controls) Creates a new OAUTHBEARER bind request with the provided set of properties.- Parameters:
properties- The set of properties to use to create this bind request. It must not benull.controls- The set of controls to include in the bind request. It may benullor empty if no controls are needed.
-
-
Method Details
-
getSASLMechanismName
Retrieves the name of the SASL mechanism used in this SASL bind request.- Specified by:
getSASLMechanismNamein classSASLBindRequest- Returns:
- The name of the SASL mechanism used in this SASL bind request.
-
getAccessToken
Retrieves the access token to include in the bind request.- Returns:
- The access token to include in the bind request.
-
getAuthorizationID
Retrieves the authorization ID to include in the GS2 header for the bind request, if any.- Returns:
- The authorization ID to include in the GS2 header for the bind
request, or
nullif no authorization ID should be included.
-
getServerAddress
Retrieves the server address to include in the bind request, if any.- Returns:
- The server address to include in the bind request, or
nullif it should be omitted.
-
getServerPort
Retrieves the server port to include in the bind request, if any.- Returns:
- The server port to include in the bind request, or
nullif it should be omitted.
-
getRequestMethod
Retrieves the method to use for HTTP-based requests, if any.- Returns:
- The method to use for HTTP-based requests, or
nullif it should be omitted from the bind request.
-
getRequestPath
Retrieves the path to use for HTTP-based requests, if any.- Returns:
- The path to use for HTTP-based requests, or
nullif it should be omitted from the bind request.
-
getRequestPostData
Retrieves the data to submit when posting an HTTP-based request, if any.- Returns:
- The post data for HTTP-based requests, or
nullif it should be omitted from the bind request.
-
getRequestQueryString
Retrieves the query string to use for HTTP-based requests, if any.- Returns:
- The query string to use for HTTP-based requests, or
nullif it should be omitted from the bind request.
-
getAdditionalKeyValuePairs
Retrieves an unmodifiable map of additional key-value pairs that should be included in the bind request.- Returns:
- An unmodifiable map of additional key-value pairs that should be
included in the bind request. It will not be
nullbut may be empty.
-
process
@NotNull protected OAUTHBEARERBindResult process(@NotNull LDAPConnection connection, int depth) throws LDAPException Sends this bind request to the target server over the provided connection and returns the corresponding response.- Specified by:
processin classBindRequest- Parameters:
connection- The connection to use to send this bind request to the server and read the associated response.depth- The current referral depth for this request. It should always be one for the initial request, and should only be incremented when following referrals.- Returns:
- The bind response read from the server.
- Throws:
LDAPException- If a problem occurs while sending the request or reading the response.
-
duplicate
Creates a new instance of this LDAP request that may be modified without impacting this request.- Specified by:
duplicatein interfaceReadOnlyLDAPRequest- Specified by:
duplicatein classBindRequest- Returns:
- A new instance of this LDAP request that may be modified without impacting this request.
-
duplicate
Creates a new instance of this LDAP request that may be modified without impacting this request. The provided controls will be used for the new request instead of duplicating the controls from this request.- Specified by:
duplicatein interfaceReadOnlyLDAPRequest- Specified by:
duplicatein classBindRequest- Parameters:
controls- The set of controls to include in the duplicate request.- Returns:
- A new instance of this LDAP request that may be modified without impacting this request.
-
getLastMessageID
Retrieves the message ID for the last LDAP message sent using this request.- Overrides:
getLastMessageIDin classSASLBindRequest- Returns:
- The message ID for the last LDAP message sent using this request, or -1 if it no LDAP messages have yet been sent using this request.
-
toString
Retrieves a string representation of the OAUTHBEARER bind request.- Specified by:
toStringin interfaceReadOnlyLDAPRequest- Overrides:
toStringin classLDAPRequest- Returns:
- A string representation of the OAUTHBEARER bind request.
-
toString
Appends a string representation of the OAUTHBEARER bind request to the provided buffer.- Specified by:
toStringin interfaceReadOnlyLDAPRequest- Specified by:
toStringin classLDAPRequest- Parameters:
buffer- The buffer to which the information should be appended. It must not benull.
-
toCode
public void toCode(@NotNull List<String> lineList, @NotNull String requestID, int indentSpaces, boolean includeProcessing) Appends a number of lines comprising the Java source code that can be used to recreate this request to the given list.- Specified by:
toCodein interfaceReadOnlyLDAPRequest- Overrides:
toCodein classSASLBindRequest- Parameters:
lineList- The list to which the source code lines should be added.requestID- The name that should be used as an identifier for the request. If this isnullor empty, then a generic ID will be used.indentSpaces- The number of spaces that should be used to indent the generated code. It must not be negative.includeProcessing- Indicates whether the generated code should include code required to actually process the request and handle the result (iftrue), or just to generate the request (iffalse).
-