com.nimbusds.openid.connect.sdk
Class UserInfoSuccessResponse

java.lang.Object
  extended by com.nimbusds.openid.connect.sdk.UserInfoResponse
      extended by com.nimbusds.openid.connect.sdk.UserInfoSuccessResponse
All Implemented Interfaces:
Message, Response, SuccessResponse

@Immutable
public final class UserInfoSuccessResponse
extends UserInfoResponse
implements SuccessResponse

UserInfo success response. This class is immutable.

The UserInfo claims may be passed as an unprotected JSON object or as a plain, signed or encrypted JSON Web Token (JWT). Use the appropriate constructor for that.

Example UserInfo HTTP response:

 HTTP/1.1 200 OK
 Content-Type: application/json
 
 {
  "sub"         : "248289761001",
  "name"        : "Jane Doe"
  "given_name"  : "Jane",
  "family_name" : "Doe",
  "email"       : "[email protected]",
  "picture"     : "http://example.com/janedoe/me.jpg"
 }
 

Related specifications:

Author:
Vladimir Dzhuvinov

Constructor Summary
UserInfoSuccessResponse(com.nimbusds.jwt.JWT jwt)
          Creates a new UserInfo success response where the claims are specified as a plain, signed or encrypted JSON Web Token (JWT).
UserInfoSuccessResponse(UserInfo claimsSet)
          Creates a new UserInfo success response where the claims are specified as an unprotected UserInfo claims set.
 
Method Summary
 javax.mail.internet.ContentType getContentType()
          Gets the content type of this UserInfo response.
 UserInfo getUserInfo()
          Gets the UserInfo claims set as an unprotected UserInfo claims set.
 com.nimbusds.jwt.JWT getUserInfoJWT()
          Gets the UserInfo claims set as a plain, signed or encrypted JSON Web Token (JWT).
static UserInfoSuccessResponse parse(HTTPResponse httpResponse)
          Parses a UserInfo response from the specified HTTP response.
 HTTPResponse toHTTPResponse()
          Returns the matching HTTP response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserInfoSuccessResponse

public UserInfoSuccessResponse(UserInfo claimsSet)
Creates a new UserInfo success response where the claims are specified as an unprotected UserInfo claims set.

Parameters:
claimsSet - The UserInfo claims set. Must not be null.

UserInfoSuccessResponse

public UserInfoSuccessResponse(com.nimbusds.jwt.JWT jwt)
Creates a new UserInfo success response where the claims are specified as a plain, signed or encrypted JSON Web Token (JWT).

Parameters:
jwt - The UserInfo claims set. Must not be null.
Method Detail

getContentType

public javax.mail.internet.ContentType getContentType()
Gets the content type of this UserInfo response.

Returns:
The content type, according to the claims format.

getUserInfo

public UserInfo getUserInfo()
Gets the UserInfo claims set as an unprotected UserInfo claims set.

Returns:
The UserInfo claims set, null if it was specified as JSON Web Token (JWT) instead.

getUserInfoJWT

public com.nimbusds.jwt.JWT getUserInfoJWT()
Gets the UserInfo claims set as a plain, signed or encrypted JSON Web Token (JWT).

Returns:
The UserInfo claims set as a JSON Web Token (JWT), null if it was specified as an unprotected UserInfo claims set instead.

toHTTPResponse

public HTTPResponse toHTTPResponse()
                            throws SerializeException
Description copied from interface: Response
Returns the matching HTTP response.

Specified by:
toHTTPResponse in interface Response
Returns:
The HTTP response.
Throws:
SerializeException - If the response message couldn't be serialised to an HTTP response.

parse

public static UserInfoSuccessResponse parse(HTTPResponse httpResponse)
                                     throws ParseException
Parses a UserInfo response from the specified HTTP response.

Example HTTP response:

 HTTP/1.1 200 OK
 Content-Type: application/json
 
 {
  "sub"         : "248289761001",
  "name"        : "Jane Doe"
  "given_name"  : "Jane",
  "family_name" : "Doe",
  "email"       : "[email protected]",
  "picture"     : "http://example.com/janedoe/me.jpg"
 }
 

Parameters:
httpResponse - The HTTP response. Must not be null.
Returns:
The UserInfo response.
Throws:
ParseException - If the HTTP response couldn't be parsed to a UserInfo response.


Copyright © 2013 NimbusDS. All Rights Reserved.