本文整理匯總了Java中org.xdi.oxauth.client.uma.wrapper.UmaClient類的典型用法代碼示例。如果您正苦於以下問題:Java UmaClient類的具體用法?Java UmaClient怎麽用?Java UmaClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UmaClient類屬於org.xdi.oxauth.client.uma.wrapper包,在下文中一共展示了UmaClient類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
@BeforeClass
@Parameters({"umaMetaDataUrl", "umaPatClientId", "umaPatClientSecret"})
public void init(final String umaMetaDataUrl, final String umaPatClientId, final String umaPatClientSecret) throws Exception {
this.metadata = UmaClientFactory.instance().createMetadataService(umaMetaDataUrl, clientExecutor(true)).getMetadata();
assert_(this.metadata);
pat = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret, clientExecutor(true));
assert_(pat);
this.registerResourceTest = new RegisterResourceFlowHttpTest(this.metadata);
this.registerResourceTest.pat = this.pat;
this.permissionFlowTest = new UmaRegisterPermissionFlowHttpTest(this.metadata);
this.permissionFlowTest.registerResourceTest = this.registerResourceTest;
this.rptStatusService = UmaClientFactory.instance().createRptStatusService(metadata, clientExecutor(true));
this.tokenService = UmaClientFactory.instance().createTokenService(metadata, clientExecutor(true));
}
示例2: init
import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
@BeforeClass
@Parameters({"umaMetaDataUrl", "umaPatClientId", "umaPatClientSecret"})
public void init(final String umaMetaDataUrl, final String umaPatClientId, final String umaPatClientSecret) throws Exception {
if (this.metadata == null) {
this.metadata = UmaClientFactory.instance().createMetadataService(umaMetaDataUrl, clientExecutor(true)).getMetadata();
UmaTestUtil.assert_(this.metadata);
}
pat = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret, clientExecutor(true));
UmaTestUtil.assert_(pat);
}
示例3: testObtainPatTokenFlow
import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
/**
* Test for the obtaining UMA PAT token
*/
@Test
@Parameters({"umaPatClientId", "umaPatClientSecret"})
public void testObtainPatTokenFlow(final String umaPatClientId, final String umaPatClientSecret) throws Exception {
showTitle("testObtainPatTokenFlow");
m_pat = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
UmaTestUtil.assert_(m_pat);
}
示例4: test
import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
@Test
@Parameters({"umaPatClientId", "umaPatClientSecret"})
public void test(final String umaPatClientId, final String umaPatClientSecret) throws Exception {
final Token authorization = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
final Token tokenToIntrospect = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
final IntrospectionService introspectionService = ClientFactory.instance().createIntrospectionService(introspectionEndpoint);
final IntrospectionResponse introspectionResponse = introspectionService.introspectToken("Bearer " + authorization.getAccessToken(), tokenToIntrospect.getAccessToken());
Assert.assertTrue(introspectionResponse != null && introspectionResponse.isActive());
}
示例5: getPassportConfig
import org.xdi.oxauth.client.uma.wrapper.UmaClient; //導入依賴的package包/類
@POST
@Produces({MediaType.APPLICATION_JSON})
public Response getPassportConfig(@FormParam(OxTrustConstants.OXAUTH_ACCESS_TOKEN) final String rpt) throws Exception{
PassportConfigResponse passportConfigResponse = null;
try{
RptStatusService rptStatusService = UmaClientFactory.instance().createRptStatusService(metadataConfiguration);
String umaPatClientId = applicationConfiguration.getOxAuthClientId();
String umaPatClientSecret = applicationConfiguration.getOxAuthClientPassword();
if (umaPatClientSecret != null) {
try {
umaPatClientSecret = StringEncrypter.defaultInstance().decrypt(umaPatClientSecret, cryptoConfigurationSalt);
} catch (EncryptionException ex) {
log.error("Failed to decrypt client password", ex);
}
}
String tokenEndpoint = metadataConfiguration.getTokenEndpoint();
Token patToken = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
if((patToken != null) ){
RptIntrospectionResponse tokenStatusResponse = rptStatusService.requestRptStatus(
"Bearer " + patToken.getAccessToken(),
rpt, "");
if((tokenStatusResponse != null) && (tokenStatusResponse.getActive())){
passportConfigResponse = new PassportConfigResponse();
LdapOxPassportConfiguration ldapOxPassportConfiguration = oxPassportService.loadConfigurationFromLdap();
List<org.xdi.config.oxtrust.PassportConfiguration> passportConfigurations =ldapOxPassportConfiguration.getPassportConfigurations();
Map <String ,PassportStrategy> PassportConfigurationsMap = new HashMap<String, PassportStrategy>();
for(org.xdi.config.oxtrust.PassportConfiguration passportConfiguration : passportConfigurations){
if(passportConfiguration.getProvider().equalsIgnoreCase("passport")){
passportConfigResponse.setApplicationEndpoint((passportConfiguration.getApplicationEndpoint()==null) ? "" : passportConfiguration.getApplicationEndpoint() );
passportConfigResponse.setAuthenticationUrl((passportConfiguration.getServerURI()==null) ? "" : passportConfiguration.getServerURI());
passportConfigResponse.setApplicationStartpoint((passportConfiguration.getApplicationStartpoint()==null) ? "" : passportConfiguration.getApplicationStartpoint());
}else{
PassportStrategy passportStrategy = new PassportStrategy();
passportStrategy.setClientID((passportConfiguration.getClientID()==null) ? "" : passportConfiguration.getClientID());
passportStrategy.setClientSecret((passportConfiguration.getClientSecret()==null) ? "" : passportConfiguration.getClientSecret());
PassportConfigurationsMap.put((passportConfiguration.getProvider()==null) ? "" : passportConfiguration.getProvider(), passportStrategy);
}
}
passportConfigResponse.setPassportStrategies(PassportConfigurationsMap);
return Response.status(Response.Status.OK).entity(passportConfigResponse).build();
}else{
log.info("Invalid GAT/RPT token. ");
return Response.status(Response.Status.UNAUTHORIZED).build();
}
}else{
log.info("Unable to get PAT token. ");
return Response.status(Response.Status.SERVICE_UNAVAILABLE).build();
}
}catch(Exception e){
log.error("Exception Occured : {0} ", e.getMessage());
e.printStackTrace();
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}