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

公開メンバ関数

String collectClaims (@RequestParam("client_id") String clientId, @RequestParam(value="redirect_uri", required=false) String redirectUri, @RequestParam("ticket") String ticketValue, @RequestParam(value="state", required=false) String state, Model m, OIDCAuthenticationToken auth)
 

静的公開変数類

static final String URL = "rqp_claims"
 

非公開メンバ関数

Claim mkClaim (String issuer, String name, JsonElement value)
 

非公開変数類

ClientDetailsEntityService clientService
 
PermissionService permissionService
 

静的非公開変数類

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

詳解

Collect claims interactively from the end user.

著者
jricher

関数詳解

◆ collectClaims()

String org.mitre.uma.web.ClaimsCollectionEndpoint.collectClaims ( @RequestParam("client_id") String  clientId,
@RequestParam(value="redirect_uri", required=false) String  redirectUri,
@RequestParam("ticket") String  ticketValue,
@RequestParam(value="state", required=false) String  state,
Model  m,
OIDCAuthenticationToken  auth 
)
inline
73  {
74 
75 
76  ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
77 
78  PermissionTicket ticket = permissionService.getByTicket(ticketValue);
79 
80  if (client == null || ticket == null) {
81  logger.info("Client or ticket not found: " + clientId + " :: " + ticketValue);
82  m.addAttribute(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
83  return HttpCodeView.VIEWNAME;
84  }
85 
86  // we've got a client and ticket, let's attach the claims that we have from the token and userinfo
87 
88  // subject
89  Set<Claim> claimsSupplied = Sets.newHashSet(ticket.getClaimsSupplied());
90 
91  String issuer = auth.getIssuer();
92  UserInfo userInfo = auth.getUserInfo();
93 
94  claimsSupplied.add(mkClaim(issuer, "sub", new JsonPrimitive(auth.getSub())));
95  if (userInfo.getEmail() != null) {
96  claimsSupplied.add(mkClaim(issuer, "email", new JsonPrimitive(userInfo.getEmail())));
97  }
98  if (userInfo.getEmailVerified() != null) {
99  claimsSupplied.add(mkClaim(issuer, "email_verified", new JsonPrimitive(userInfo.getEmailVerified())));
100  }
101  if (userInfo.getPhoneNumber() != null) {
102  claimsSupplied.add(mkClaim(issuer, "phone_number", new JsonPrimitive(auth.getUserInfo().getPhoneNumber())));
103  }
104  if (userInfo.getPhoneNumberVerified() != null) {
105  claimsSupplied.add(mkClaim(issuer, "phone_number_verified", new JsonPrimitive(auth.getUserInfo().getPhoneNumberVerified())));
106  }
107  if (userInfo.getPreferredUsername() != null) {
108  claimsSupplied.add(mkClaim(issuer, "preferred_username", new JsonPrimitive(auth.getUserInfo().getPreferredUsername())));
109  }
110  if (userInfo.getProfile() != null) {
111  claimsSupplied.add(mkClaim(issuer, "profile", new JsonPrimitive(auth.getUserInfo().getProfile())));
112  }
113 
114  ticket.setClaimsSupplied(claimsSupplied);
115 
116  PermissionTicket updatedTicket = permissionService.updateTicket(ticket);
117 
118  if (Strings.isNullOrEmpty(redirectUri)) {
119  if (client.getClaimsRedirectUris().size() == 1) {
120  redirectUri = client.getClaimsRedirectUris().iterator().next(); // get the first (and only) redirect URI to use here
121  logger.info("No redirect URI passed in, using registered value: " + redirectUri);
122  } else {
123  throw new RedirectMismatchException("Unable to find redirect URI and none passed in.");
124  }
125  } else {
126  if (!client.getClaimsRedirectUris().contains(redirectUri)) {
127  throw new RedirectMismatchException("Claims redirect did not match the registered values.");
128  }
129  }
130 
131  UriComponentsBuilder template = UriComponentsBuilder.fromUriString(redirectUri);
132  template.queryParam("authorization_state", "claims_submitted");
133  if (!Strings.isNullOrEmpty(state)) {
134  template.queryParam("state", state);
135  }
136 
137  String uriString = template.toUriString();
138  logger.info("Redirecting to " + uriString);
139 
140  return "redirect:" + uriString;
141  }
static final Logger logger
Definition: ClaimsCollectionEndpoint.java:59
PermissionService permissionService
Definition: ClaimsCollectionEndpoint.java:67
PermissionTicket getByTicket(String ticket)
ClientDetailsEntityService clientService
Definition: ClaimsCollectionEndpoint.java:64
PermissionTicket updateTicket(PermissionTicket ticket)
ClientDetailsEntity loadClientByClientId(String clientId)
Claim mkClaim(String issuer, String name, JsonElement value)
Definition: ClaimsCollectionEndpoint.java:144

◆ mkClaim()

Claim org.mitre.uma.web.ClaimsCollectionEndpoint.mkClaim ( String  issuer,
String  name,
JsonElement  value 
)
inlineprivate
144  {
145  Claim c = new Claim();
146  c.setIssuer(Sets.newHashSet(issuer));
147  c.setName(name);
148  c.setValue(value);
149  return c;
150  }

メンバ詳解

◆ clientService

ClientDetailsEntityService org.mitre.uma.web.ClaimsCollectionEndpoint.clientService
private

◆ logger

final Logger org.mitre.uma.web.ClaimsCollectionEndpoint.logger = LoggerFactory.getLogger(ClaimsCollectionEndpoint.class)
staticprivate

◆ permissionService

PermissionService org.mitre.uma.web.ClaimsCollectionEndpoint.permissionService
private

◆ URL

final String org.mitre.uma.web.ClaimsCollectionEndpoint.URL = "rqp_claims"
static

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