本文整理汇总了Java中org.xdi.oxauth.model.common.ResponseType类的典型用法代码示例。如果您正苦于以下问题:Java ResponseType类的具体用法?Java ResponseType怎么用?Java ResponseType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResponseType类属于org.xdi.oxauth.model.common包,在下文中一共展示了ResponseType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchAvailableResponseTypes
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
@Restrict("#{s:hasPermission('client', 'access')}")
public void searchAvailableResponseTypes() {
if (this.availableResponseTypes != null) {
selectAddedResponseTypes();
return;
}
List<SelectableEntity<ResponseType>> tmpAvailableResponseTypes = new ArrayList<SelectableEntity<ResponseType>>();
for (ResponseType responseType : ResponseType.values()) {
tmpAvailableResponseTypes.add(new SelectableEntity<ResponseType>(responseType));
}
this.availableResponseTypes = tmpAvailableResponseTypes;
selectAddedResponseTypes();
}
示例2: getRedirectionUrl
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public String getRedirectionUrl(final WebContext context) {
init();
final String state = RandomStringUtils.randomAlphanumeric(10);
final String nonce = RandomStringUtils.randomAlphanumeric(10);
final AuthorizationRequest authorizationRequest = new AuthorizationRequest(Arrays.asList(ResponseType.CODE), this.clientId, this.appConfiguration.getOpenIdScopes(),
this.appConfiguration.getOpenIdRedirectUrl(), null);
authorizationRequest.setState(state);
authorizationRequest.setNonce(nonce);
context.setSessionAttribute(getName() + STATE_PARAMETER, state);
final String redirectionUrl = this.openIdConfiguration.getAuthorizationEndpoint() + "?" + authorizationRequest.getQueryString();
logger.debug("oxAuth redirection Url: '{}'", redirectionUrl);
return redirectionUrl;
}
示例3: RegisterRequest
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
/**
* Private common constructor.
*/
private RegisterRequest() {
setContentType(MediaType.APPLICATION_JSON);
setMediaType(MediaType.APPLICATION_JSON);
this.redirectUris = new ArrayList<String>();
this.claimsRedirectUris = new ArrayList<String>();
this.responseTypes = new ArrayList<ResponseType>();
this.grantTypes = new ArrayList<GrantType>();
this.contacts = new ArrayList<String>();
this.defaultAcrValues = new ArrayList<String>();
this.postLogoutRedirectUris = new ArrayList<String>();
this.requestUris = new ArrayList<String>();
this.scopes = new ArrayList<String>();
this.customAttributes = new HashMap<String, String>();
}
示例4: responseTypesCodeIdTokenStep4DataProvider
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
@DataProvider(name = "responseTypesCodeIdTokenStep4DataProvider")
public Object[][] responseTypesCodeIdTokenStep4DataProvider(ITestContext context) {
String authorizePath = context.getCurrentXmlTest().getParameter("authorizePath");
String userId = context.getCurrentXmlTest().getParameter("userId");
String userSecret = context.getCurrentXmlTest().getParameter("userSecret");
String redirectUri = context.getCurrentXmlTest().getParameter("redirectUri");
return new Object[][]{{authorizePath, userId, userSecret, redirectUri, Arrays.asList(ResponseType.TOKEN)},
{authorizePath, userId, userSecret, redirectUri,
Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN)},
{authorizePath, userId, userSecret, redirectUri,
Arrays.asList(ResponseType.CODE, ResponseType.TOKEN)},
{authorizePath, userId, userSecret, redirectUri,
Arrays.asList(ResponseType.CODE, ResponseType.TOKEN, ResponseType.ID_TOKEN)},
{authorizePath, userId, userSecret, redirectUri, Arrays.asList(ResponseType.ID_TOKEN)},};
}
示例5: rejectRegistrationOfRedirectUriWithFragment
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
@Parameters({"redirectUri"})
@Test
public void rejectRegistrationOfRedirectUriWithFragment(final String redirectUri) throws Exception {
showTitle("OC5:FeatureTest-Reject Registration of redirect uri with Fragment");
List<ResponseType> responseTypes = Arrays.asList(ResponseType.CODE);
// 1. Register client
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
StringUtils.spaceSeparatedToList(redirectUri + "#foo1=bar"));
registerRequest.setResponseTypes(responseTypes);
RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setRequest(registerRequest);
RegisterResponse registerResponse = registerClient.exec();
showClient(registerClient);
assertEquals(registerResponse.getStatus(), 400, "Unexpected response code: " + registerResponse.getStatus());
assertNotNull(registerResponse.getErrorType(), "The error type is null");
assertNotNull(registerResponse.getErrorDescription(), "The error description is null");
}
示例6: updateResponseTypes
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
private void updateResponseTypes() {
List<ResponseType> currentResponseTypes = this.responseTypes;
if (currentResponseTypes == null || currentResponseTypes.size() == 0) {
this.client.setResponseTypes(null);
return;
}
this.client.setResponseTypes(currentResponseTypes.toArray(new ResponseType[currentResponseTypes.size()]));
}
示例7: getInitialResponseTypes
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
private List<ResponseType> getInitialResponseTypes() {
List<ResponseType> result = new ArrayList<ResponseType>();
ResponseType[] currentResponseTypes = this.client.getResponseTypes();
if ((currentResponseTypes == null) || (currentResponseTypes.length == 0)) {
return result;
}
result.addAll(Arrays.asList(currentResponseTypes));
return result;
}
示例8: acceptSelectResponseTypes
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
@Restrict("#{s:hasPermission('client', 'access')}")
public void acceptSelectResponseTypes() {
List<ResponseType> addedResponseTypes = getResponseTypes();
for (SelectableEntity<ResponseType> availableResponseType : this.availableResponseTypes) {
ResponseType responseType = availableResponseType.getEntity();
if (availableResponseType.isSelected() && !addedResponseTypes.contains(responseType)) {
addResponseType(responseType.getValue());
}
if (!availableResponseType.isSelected() && addedResponseTypes.contains(responseType)) {
removeResponseType(responseType.getValue());
}
}
}
示例9: selectAddedResponseTypes
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
private void selectAddedResponseTypes() {
List<ResponseType> addedResponseTypes = getResponseTypes();
for (SelectableEntity<ResponseType> availableResponseType : this.availableResponseTypes) {
availableResponseType.setSelected(addedResponseTypes.contains(availableResponseType.getEntity()));
}
}
示例10: isAuthorizationResponse
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean isAuthorizationResponse(final WebContext context) {
final String authorizationCode = context.getRequestParameter(ResponseType.CODE.getValue());
logger.debug("oxAuth authorization code: '{}'", authorizationCode);
final boolean result = StringHelper.isNotEmpty(authorizationCode);
logger.debug("Is authorization request: '{}'", result);
return result;
}
示例11: getCredentials
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final OpenIdCredentials getCredentials(final WebContext context) {
final String authorizationCode = context.getRequestParameter(ResponseType.CODE.getValue());
final OpenIdCredentials clientCredential = new OpenIdCredentials(authorizationCode);
clientCredential.setClientName(getName());
logger.debug("Client credential: '{}'", clientCredential);
return clientCredential;
}
示例12: acceptSelectResponseTypes
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
public void acceptSelectResponseTypes() {
List<ResponseType> addedResponseTypes = getResponseTypes();
for (SelectableEntity<ResponseType> availableResponseType : this.availableResponseTypes) {
ResponseType responseType = availableResponseType.getEntity();
if (availableResponseType.isSelected() && !addedResponseTypes.contains(responseType)) {
addResponseType(responseType.getValue());
}
if (!availableResponseType.isSelected() && addedResponseTypes.contains(responseType)) {
removeResponseType(responseType.getValue());
}
}
}
示例13: requestParameterMethodRS256Step1
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
@Parameters({ "registerPath", "redirectUris", "clientJwksUri" })
@Test
public void requestParameterMethodRS256Step1(final String registerPath, final String redirectUris,
final String jwksUri) throws Exception {
Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
String registerRequestContent = null;
try {
List<ResponseType> responseTypes = Arrays.asList(ResponseType.TOKEN);
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
StringUtils.spaceSeparatedToList(redirectUris));
registerRequest.setJwksUri(jwksUri);
registerRequest.setResponseTypes(responseTypes);
registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.RS256);
registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
registerRequestContent = registerRequest.getJSONParameters().toString(4);
} catch (JSONException e) {
e.printStackTrace();
fail(e.getMessage());
}
Response response = request.post(Entity.json(registerRequestContent));
String entity = response.readEntity(String.class);
showResponse("requestParameterMethodRS256Step1", response, entity);
ResponseAsserter responseAsserter = ResponseAsserter.of(response);
responseAsserter.assertRegisterResponse();
clientId1 = responseAsserter.getJson().getJson().getString(RegisterResponseParam.CLIENT_ID.toString());
}
示例14: isAuthorizationResponse
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
/**
* {@InheritDoc}
*/
@Override
public boolean isAuthorizationResponse(final WebContext context) {
final String authorizationCode = context.getRequestParameter(ResponseType.CODE.getValue());
logger.debug("oxAuth authorization code: '{}'", authorizationCode);
final boolean result = StringHelper.isNotEmpty(authorizationCode);
logger.debug("Is authorization request: '{}'", result);
return result;
}
示例15: requestAuthorizationTokenFail1
import org.xdi.oxauth.model.common.ResponseType; //导入依赖的package包/类
@Parameters({ "authorizePath", "userId", "userSecret", "redirectUri" })
@Test
public void requestAuthorizationTokenFail1(final String authorizePath, final String userId, final String userSecret,
final String redirectUri) throws Exception {
final String state = UUID.randomUUID().toString();
// Testing with missing parameters
List<ResponseType> responseTypes = Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN);
List<String> scopes = Arrays.asList("openid", "profile", "address", "email");
String nonce = UUID.randomUUID().toString();
AuthorizationRequest authorizationRequest = new AuthorizationRequest(responseTypes, null, scopes, redirectUri,
nonce);
authorizationRequest.setState(state);
authorizationRequest.setAuthUsername(userId);
authorizationRequest.setAuthPassword(userSecret);
Builder request = ResteasyClientBuilder.newClient()
.target(url.toString() + authorizePath + "?" + authorizationRequest.getQueryString()).request();
request.header("Authorization", "Basic " + authorizationRequest.getEncodedCredentials());
request.header("Accept", MediaType.TEXT_PLAIN);
Response response = request.get();
String entity = response.readEntity(String.class);
showResponse("requestAuthorizationTokenFail1", response, entity);
assertEquals(response.getStatus(), 400, "Unexpected response code.");
assertNotNull(entity, "Unexpected result: " + entity);
try {
JSONObject jsonObj = new JSONObject(entity);
assertTrue(jsonObj.has("error"), "The error type is null");
assertEquals(jsonObj.getString("error"), "invalid_request");
assertTrue(jsonObj.has("error_description"), "The error description is null");
assertEquals(jsonObj.get(AuthorizeResponseParam.STATE), state);
} catch (JSONException e) {
e.printStackTrace();
fail(e.getMessage() + "\nResponse was: " + entity);
}
}