Tabnine Logo
Association.sign
Code IndexAdd Tabnine to your IDE (free)

How to use
sign
method
in
org.openid4java.association.Association

Best Java code snippets using org.openid4java.association.Association.sign (Showing top 20 results out of 315)

origin: org.openid4java/openid4java-nodeps

  public boolean verifySignature(String text, String signature) throws AssociationException
  {
    if (DEBUG) _log.debug("Verifying signature: " + signature);
    // The Java String.equals() method returns on the first difference in
    // its inputs, which allows a timing attack to recover signature values.
    // This verification method will take the same amount of time for any
    // two inputs of equal length.
    String textSig = sign(text);
    if (textSig.length() == 0 || textSig.length() != signature.length()) {
     return false;
    }

    int result = 0;
    for (int i = 0; i < textSig.length(); i++) {
     result |= textSig.charAt(i) ^ signature.charAt(i);
    }
    return result == 0;
  }
}
origin: com.cloudbees/openid4java-shaded

  public boolean verifySignature(String text, String signature) throws AssociationException
  {
    if (DEBUG) _log.debug("Verifying signature: " + signature);
    // The Java String.equals() method returns on the first difference in
    // its inputs, which allows a timing attack to recover signature values.
    // This verification method will take the same amount of time for any
    // two inputs of equal length.
    String textSig = sign(text);
    if (textSig.length() == 0 || textSig.length() != signature.length()) {
     return false;
    }

    int result = 0;
    for (int i = 0; i < textSig.length(); i++) {
     result |= textSig.charAt(i) ^ signature.charAt(i);
    }
    return result == 0;
  }
}
origin: org.openid4java/openid4java

  public boolean verifySignature(String text, String signature) throws AssociationException
  {
    if (DEBUG) _log.debug("Verifying signature: " + signature);
    // The Java String.equals() method returns on the first difference in
    // its inputs, which allows a timing attack to recover signature values.
    // This verification method will take the same amount of time for any
    // two inputs of equal length.
    String textSig = sign(text);
    if (textSig.length() == 0 || textSig.length() != signature.length()) {
     return false;
    }

    int result = 0;
    for (int i = 0; i < textSig.length(); i++) {
     result |= textSig.charAt(i) ^ signature.charAt(i);
    }
    return result == 0;
  }
}
origin: jbufu/openid4java

public String sign(String text) throws AssociationException
{
  if (DEBUG) _log.debug("Computing signature for input data:\n" + text);
  try
  {
    String signature = new String(Base64.encodeBase64(sign(text.getBytes("utf-8"))), "utf-8");
    if (DEBUG)
      _log.debug("Calculated signature: " + signature);
    return signature;
  }
  catch (UnsupportedEncodingException e)
  {
    throw new AssociationException("Unsupported encoding for signed text.", e);
  }
}
origin: org.wso2.org.openid4java/openid4java-nodeps

public String sign(String text) throws AssociationException {
  if (DEBUG) {
    _log.debug("Computing signature for input data:\n" + text);
  }
  try {
    String signature = new String(Base64.encodeBase64(sign(text.getBytes("utf-8"))), "utf-8");
    if (DEBUG) {
      _log.debug("Calculated signature: " + signature);
    }
    return signature;
  } catch (UnsupportedEncodingException e) {
    throw new AssociationException("Unsupported encoding for signed text.", e);
  }
}
origin: org.wso2.org.openid4java/openid4java-nodeps

  public boolean verifySignature(String text, String signature) throws AssociationException {
    if (DEBUG) {
      _log.debug("Verifying signature: " + signature);
    }
    // The Java String.equals() method returns on the first difference in
    // its inputs, which allows a timing attack to recover signature values.
    // This verification method will take the same amount of time for any
    // two inputs of equal length.
    String textSig = sign(text);
    if (textSig.length() == 0 || textSig.length() != signature.length()) {
      return false;
    }

    int result = 0;
    for (int i = 0; i < textSig.length(); i++) {
      result |= textSig.charAt(i) ^ signature.charAt(i);
    }
    return result == 0;
  }
}
origin: org.openid4java/openid4java

public String sign(String text) throws AssociationException
{
  if (DEBUG) _log.debug("Computing signature for input data:\n" + text);
  try
  {
    String signature = new String(Base64.encodeBase64(sign(text.getBytes("utf-8"))), "utf-8");
    if (DEBUG)
      _log.debug("Calculated signature: " + signature);
    return signature;
  }
  catch (UnsupportedEncodingException e)
  {
    throw new AssociationException("Unsupported encoding for signed text.", e);
  }
}
origin: jbufu/openid4java

  public boolean verifySignature(String text, String signature) throws AssociationException
  {
    if (DEBUG) _log.debug("Verifying signature: " + signature);
    // The Java String.equals() method returns on the first difference in
    // its inputs, which allows a timing attack to recover signature values.
    // This verification method will take the same amount of time for any
    // two inputs of equal length.
    String textSig = sign(text);
    if (textSig.length() == 0 || textSig.length() != signature.length()) {
     return false;
    }

    int result = 0;
    for (int i = 0; i < textSig.length(); i++) {
     result |= textSig.charAt(i) ^ signature.charAt(i);
    }
    return result == 0;
  }
}
origin: org.openid4java/openid4java-nodeps

public String sign(String text) throws AssociationException
{
  if (DEBUG) _log.debug("Computing signature for input data:\n" + text);
  try
  {
    String signature = new String(Base64.encodeBase64(sign(text.getBytes("utf-8"))), "utf-8");
    if (DEBUG)
      _log.debug("Calculated signature: " + signature);
    return signature;
  }
  catch (UnsupportedEncodingException e)
  {
    throw new AssociationException("Unsupported encoding for signed text.", e);
  }
}
origin: com.cloudbees/openid4java-shaded

public String sign(String text) throws AssociationException
{
  if (DEBUG) _log.debug("Computing signature for input data:\n" + text);
  try
  {
    String signature = new String(Base64.encodeBase64(sign(text.getBytes("utf-8"))), "utf-8");
    if (DEBUG)
      _log.debug("Calculated signature: " + signature);
    return signature;
  }
  catch (UnsupportedEncodingException e)
  {
    throw new AssociationException("Unsupported encoding for signed text.", e);
  }
}
origin: org.openid4java/openid4java-nodeps

/**
 * Signs an AuthSuccess message, using the association identified by the
 * handle specified within the message.
 *
 * @param   authSuccess     The Authentication Success message to be signed.
 *
 * @throws  ServerException If the Association corresponding to the handle
 *                          in the @authSuccess cannot be retrieved from
 *                          the store.
 * @throws  AssociationException    If the signature cannot be computed.
 *
 */
public void sign(AuthSuccess authSuccess)
  throws ServerException, AssociationException
{
  String handle = authSuccess.getHandle();
  // try shared associations first, then private
  Association assoc = _sharedAssociations.load(handle);
  if (assoc == null)
    assoc = _privateAssociations.load(handle);
  if (assoc == null) throw new ServerException(
      "No association found for handle: " + handle);
  authSuccess.setSignature(assoc.sign(authSuccess.getSignedText()));
}
origin: com.cloudbees/openid4java-shaded

/**
 * Signs an AuthSuccess message, using the association identified by the
 * handle specified within the message.
 *
 * @param   authSuccess     The Authentication Success message to be signed.
 *
 * @throws  ServerException If the Association corresponding to the handle
 *                          in the @authSuccess cannot be retrieved from
 *                          the store.
 * @throws  AssociationException    If the signature cannot be computed.
 *
 */
public void sign(AuthSuccess authSuccess)
  throws ServerException, AssociationException
{
  String handle = authSuccess.getHandle();
  // try shared associations first, then private
  Association assoc = _sharedAssociations.load(handle);
  if (assoc == null)
    assoc = _privateAssociations.load(handle);
  if (assoc == null) throw new ServerException(
      "No association found for handle: " + handle);
  authSuccess.setSignature(assoc.sign(authSuccess.getSignedText()));
}
origin: jbufu/openid4java

/**
 * Signs an AuthSuccess message, using the association identified by the
 * handle specified within the message.
 *
 * @param   authSuccess     The Authentication Success message to be signed.
 *
 * @throws  ServerException If the Association corresponding to the handle
 *                          in the @authSuccess cannot be retrieved from
 *                          the store.
 * @throws  AssociationException    If the signature cannot be computed.
 *
 */
public void sign(AuthSuccess authSuccess)
  throws ServerException, AssociationException
{
  String handle = authSuccess.getHandle();
  // try shared associations first, then private
  Association assoc = _sharedAssociations.load(handle);
  if (assoc == null)
    assoc = _privateAssociations.load(handle);
  if (assoc == null) throw new ServerException(
      "No association found for handle: " + handle);
  authSuccess.setSignature(assoc.sign(authSuccess.getSignedText()));
}
origin: org.wso2.carbon.identity.inbound.auth.openid/org.wso2.carbon.identity.provider

public void sign(AuthSuccess authSuccess)
    throws ServerException, AssociationException {
  String handle = authSuccess.getHandle();
  Association assoc = null;
  try {
    // First try in thread local
    assoc = getThreadLocalAssociation();
  } finally {
    // Clear thread local
    clearThreadLocalAssociation();
  }
  // try shared associations, then private
  if (assoc == null) {
    assoc = getSharedAssociations().load(handle);
  }
  if (assoc == null) {
    assoc = getPrivateAssociations().load(handle);
  }
  if (assoc == null) {
    throw new ServerException("No association found for handle: " + handle);
  }
  authSuccess.setSignature(assoc.sign(authSuccess.getSignedText()));
}
origin: org.wso2.carbon.identity/org.wso2.carbon.identity.provider

public void sign(AuthSuccess authSuccess)
    throws ServerException, AssociationException {
  String handle = authSuccess.getHandle();
  Association assoc = null;
  try {
    // First try in thread local
    assoc = getThreadLocalAssociation();
  } finally {
    // Clear thread local
    clearThreadLocalAssociation();
  }
  // try shared associations, then private
  if (assoc == null) {
    assoc = getSharedAssociations().load(handle);
  }
  if (assoc == null) {
    assoc = getPrivateAssociations().load(handle);
  }
  if (assoc == null) {
    throw new ServerException("No association found for handle: " + handle);
  }
  authSuccess.setSignature(assoc.sign(authSuccess.getSignedText()));
}
origin: com.cloudbees/openid4java-shaded

protected AuthSuccess(String opEndpoint, String claimedId, String delegate,
           boolean compatibility,
           String returnTo, String nonce,
           String invalidateHandle, Association assoc,
           boolean signNow)
    throws AssociationException
{
  if (! compatibility)
  {
    set("openid.ns", OPENID2_NS);
    setOpEndpoint(opEndpoint);
    setClaimed(claimedId);
    setNonce(nonce);
  }
  set("openid.mode", MODE_IDRES);
  setIdentity(delegate);
  setReturnTo(returnTo);
  if (invalidateHandle != null) setInvalidateHandle(invalidateHandle);
  setHandle(assoc.getHandle());
  buildSignedList();
  setSignature(signNow ? assoc.sign(getSignedText()) : "");
}
origin: org.wso2.org.openid4java/openid4java-nodeps

protected AuthSuccess(String opEndpoint, String claimedId, String delegate,
           boolean compatibility,
           String returnTo, String nonce,
           String invalidateHandle, Association assoc,
           boolean signNow)
    throws AssociationException {
  if (!compatibility) {
    set("openid.ns", OPENID2_NS);
    setOpEndpoint(opEndpoint);
    setClaimed(claimedId);
    setNonce(nonce);
  }
  set("openid.mode", MODE_IDRES);
  setIdentity(delegate);
  setReturnTo(returnTo);
  if (invalidateHandle != null) {
    setInvalidateHandle(invalidateHandle);
  }
  setHandle(assoc.getHandle());
  buildSignedList();
  setSignature(signNow ? assoc.sign(getSignedText()) : "");
}
origin: org.openid4java/openid4java

protected AuthSuccess(String opEndpoint, String claimedId, String delegate,
           boolean compatibility,
           String returnTo, String nonce,
           String invalidateHandle, Association assoc,
           boolean signNow)
    throws AssociationException
{
  if (! compatibility)
  {
    set("openid.ns", OPENID2_NS);
    setOpEndpoint(opEndpoint);
    setClaimed(claimedId);
    setNonce(nonce);
  }
  set("openid.mode", MODE_IDRES);
  setIdentity(delegate);
  setReturnTo(returnTo);
  if (invalidateHandle != null) setInvalidateHandle(invalidateHandle);
  setHandle(assoc.getHandle());
  buildSignedList();
  setSignature(signNow ? assoc.sign(getSignedText()) : "");
}
origin: org.openid4java/openid4java-nodeps

protected AuthSuccess(String opEndpoint, String claimedId, String delegate,
           boolean compatibility,
           String returnTo, String nonce,
           String invalidateHandle, Association assoc,
           boolean signNow)
    throws AssociationException
{
  if (! compatibility)
  {
    set("openid.ns", OPENID2_NS);
    setOpEndpoint(opEndpoint);
    setClaimed(claimedId);
    setNonce(nonce);
  }
  set("openid.mode", MODE_IDRES);
  setIdentity(delegate);
  setReturnTo(returnTo);
  if (invalidateHandle != null) setInvalidateHandle(invalidateHandle);
  setHandle(assoc.getHandle());
  buildSignedList();
  setSignature(signNow ? assoc.sign(getSignedText()) : "");
}
origin: jbufu/openid4java

protected AuthSuccess(String opEndpoint, String claimedId, String delegate,
           boolean compatibility,
           String returnTo, String nonce,
           String invalidateHandle, Association assoc,
           boolean signNow)
    throws AssociationException
{
  if (! compatibility)
  {
    set("openid.ns", OPENID2_NS);
    setOpEndpoint(opEndpoint);
    setClaimed(claimedId);
    setNonce(nonce);
  }
  set("openid.mode", MODE_IDRES);
  setIdentity(delegate);
  setReturnTo(returnTo);
  if (invalidateHandle != null) setInvalidateHandle(invalidateHandle);
  setHandle(assoc.getHandle());
  buildSignedList();
  setSignature(signNow ? assoc.sign(getSignedText()) : "");
}
org.openid4java.associationAssociationsign

Popular methods of Association

  • getHandle
  • hasExpired
  • createHmacSha1
  • createHmacSha256
  • generate
  • getExpiry
  • getMacKey
  • getType
  • verifySignature
  • <init>
  • createMacKey
  • generateHmacSha1
  • createMacKey,
  • generateHmacSha1,
  • generateHmacSha256,
  • generateMacKey,
  • generateMacSha1Key,
  • generateMacSha256Key,
  • getFailedAssociation,
  • isHmacSha256Supported,
  • isHmacSupported

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JCheckBox (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now