mitreid-connect
公開メンバ関数 | 静的公開変数類 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.mitre.openid.connect.web.UserInfoEndpoint クラス
org.mitre.openid.connect.web.UserInfoEndpoint 連携図
Collaboration graph

公開メンバ関数

String getInfo (@RequestParam(value="claims", required=false) String claimsRequestJsonString, @RequestHeader(value=HttpHeaders.ACCEPT, required=false) String acceptHeader, OAuth2Authentication auth, Model model)
 

静的公開変数類

static final String URL = "userinfo"
 

非公開変数類

UserInfoService userInfoService
 
ClientDetailsEntityService clientService
 

静的非公開変数類

static final Logger logger = LoggerFactory.getLogger(UserInfoEndpoint.class)
 

詳解

OpenID Connect UserInfo endpoint, as specified in Standard sec 5 and Messages sec 2.4.

著者
AANGANES

関数詳解

◆ getInfo()

String org.mitre.openid.connect.web.UserInfoEndpoint.getInfo ( @RequestParam(value="claims", required=false) String  claimsRequestJsonString,
@RequestHeader(value=HttpHeaders.ACCEPT, required=false) String  acceptHeader,
OAuth2Authentication  auth,
Model  model 
)
inline

Get information about the user as specified in the accessToken included in this request

77  {
78 
79  if (auth == null) {
80  logger.error("getInfo failed; no principal. Requester is not authorized.");
81  model.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN);
82  return HttpCodeView.VIEWNAME;
83  }
84 
85  String username = auth.getName();
86  UserInfo userInfo = userInfoService.getByUsernameAndClientId(username, auth.getOAuth2Request().getClientId());
87 
88  if (userInfo == null) {
89  logger.error("getInfo failed; user not found: " + username);
90  model.addAttribute(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
91  return HttpCodeView.VIEWNAME;
92  }
93 
94  model.addAttribute(UserInfoView.SCOPE, auth.getOAuth2Request().getScope());
95 
96  model.addAttribute(UserInfoView.AUTHORIZED_CLAIMS, auth.getOAuth2Request().getExtensions().get("claims"));
97 
98  if (!Strings.isNullOrEmpty(claimsRequestJsonString)) {
99  model.addAttribute(UserInfoView.REQUESTED_CLAIMS, claimsRequestJsonString);
100  }
101 
102  model.addAttribute(UserInfoView.USER_INFO, userInfo);
103 
104  // content negotiation
105 
106  // start off by seeing if the client has registered for a signed/encrypted JWT from here
107  ClientDetailsEntity client = clientService.loadClientByClientId(auth.getOAuth2Request().getClientId());
108  model.addAttribute(UserInfoJWTView.CLIENT, client);
109 
110  List<MediaType> mediaTypes = MediaType.parseMediaTypes(acceptHeader);
111  MediaType.sortBySpecificityAndQuality(mediaTypes);
112 
113  if (client.getUserInfoSignedResponseAlg() != null
114  || client.getUserInfoEncryptedResponseAlg() != null
115  || client.getUserInfoEncryptedResponseEnc() != null) {
116  // client has a preference, see if they ask for plain JSON specifically on this request
117  for (MediaType m : mediaTypes) {
118  if (!m.isWildcardType() && m.isCompatibleWith(UserInfoJWTView.JOSE_MEDIA_TYPE)) {
119  return UserInfoJWTView.VIEWNAME;
120  } else if (!m.isWildcardType() && m.isCompatibleWith(MediaType.APPLICATION_JSON)) {
121  return UserInfoView.VIEWNAME;
122  }
123  }
124 
125  // otherwise return JWT
126  return UserInfoJWTView.VIEWNAME;
127  } else {
128  // client has no preference, see if they asked for JWT specifically on this request
129  for (MediaType m : mediaTypes) {
130  if (!m.isWildcardType() && m.isCompatibleWith(MediaType.APPLICATION_JSON)) {
131  return UserInfoView.VIEWNAME;
132  } else if (!m.isWildcardType() && m.isCompatibleWith(UserInfoJWTView.JOSE_MEDIA_TYPE)) {
133  return UserInfoJWTView.VIEWNAME;
134  }
135  }
136 
137  // otherwise return JSON
138  return UserInfoView.VIEWNAME;
139  }
140 
141  }
ClientDetailsEntityService clientService
Definition: UserInfoEndpoint.java:63
UserInfo getByUsernameAndClientId(String username, String clientId)
UserInfoService userInfoService
Definition: UserInfoEndpoint.java:60
ClientDetailsEntity loadClientByClientId(String clientId)
static final Logger logger
Definition: UserInfoEndpoint.java:68

メンバ詳解

◆ clientService

ClientDetailsEntityService org.mitre.openid.connect.web.UserInfoEndpoint.clientService
private

◆ logger

final Logger org.mitre.openid.connect.web.UserInfoEndpoint.logger = LoggerFactory.getLogger(UserInfoEndpoint.class)
staticprivate

Logger for this class

◆ URL

final String org.mitre.openid.connect.web.UserInfoEndpoint.URL = "userinfo"
static

◆ userInfoService

UserInfoService org.mitre.openid.connect.web.UserInfoEndpoint.userInfoService
private

このクラス詳解は次のファイルから抽出されました: