Class DefaultOAuth1Provider.Consumer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> attributes  
      private java.lang.String key  
      private java.lang.String owner  
      private java.lang.String secret  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Consumer​(java.lang.String key, java.lang.String secret, java.lang.String owner, java.util.Map<java.lang.String,​java.util.List<java.lang.String>> attributes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getAttributes()
      Returns additional attributes associated with the consumer (e.g.
      java.lang.String getKey()
      Returns consumer key.
      java.lang.String getOwner()
      Returns identifier of owner of this consumer - i.e.
      java.security.Principal getPrincipal()
      Returns a Principal object representing this consumer.
      java.lang.String getSecret()
      Returns consumer secret.
      boolean isInRole​(java.lang.String role)
      Returns a boolean indicating whether this consumer is authorized for the specified logical "role".
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • key

        private final java.lang.String key
      • secret

        private final java.lang.String secret
      • owner

        private final java.lang.String owner
      • attributes

        private final javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> attributes
    • Constructor Detail

      • Consumer

        private Consumer​(java.lang.String key,
                         java.lang.String secret,
                         java.lang.String owner,
                         java.util.Map<java.lang.String,​java.util.List<java.lang.String>> attributes)
    • Method Detail

      • getKey

        public java.lang.String getKey()
        Description copied from interface: OAuth1Consumer
        Returns consumer key.
        Specified by:
        getKey in interface OAuth1Consumer
        Returns:
        consumer key
      • getSecret

        public java.lang.String getSecret()
        Description copied from interface: OAuth1Consumer
        Returns consumer secret.
        Specified by:
        getSecret in interface OAuth1Consumer
        Returns:
        consumer secret
      • getOwner

        public java.lang.String getOwner()
        Returns identifier of owner of this consumer - i.e. who registered the consumer.
        Returns:
        consumer owner
      • getAttributes

        public javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getAttributes()
        Returns additional attributes associated with the consumer (e.g. name, URI, description, etc.)
        Returns:
        name-values pairs of additional attributes
      • getPrincipal

        public java.security.Principal getPrincipal()
        Description copied from interface: OAuth1Consumer
        Returns a Principal object representing this consumer. When the oauth filter verifies the request and no access token is provided, this is the principal that will get set to the security context. This can be used for 2-legged oauth. If the server does not allow consumers acting on their own (with no access token), this method should return null.
        Specified by:
        getPrincipal in interface OAuth1Consumer
        Returns:
        Principal corresponding to this consumer, or null if 2-legged oauth not supported (i.e. consumers can't act on their own)
      • isInRole

        public boolean isInRole​(java.lang.String role)
        Description copied from interface: OAuth1Consumer
        Returns a boolean indicating whether this consumer is authorized for the specified logical "role". When the oauth filter verifies the request and no access token is provided (2-legged oauth), it sets the consumer object to the security context which then delegates SecurityContext.isUserInRole(String) to this method.
        Specified by:
        isInRole in interface OAuth1Consumer
        Parameters:
        role - a String specifying the name of the role
        Returns:
        a boolean indicating whether this token is authorized for a given role