|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.idoox.wasp.WaspSecurity
This class allows integration of security to WSO2 SOA Enablement Server core, the functionality of WSO2 SOA Enablement Server security
is covered by its WaspSecurity.SPI
. All methods defined here
are transient, i.e. all the settings applied through the instance of this class
will disappear after restart of WSO2 SOA Enablement Server. The documentation of methods refers to execution context,
this context is defined as:
Nested Class Summary | |
static class |
WaspSecurity.SPI
This class defines the Service Provider Interface (SPI) for the WaspSecurity class. |
static class |
WaspSecurity.WaspSecurityImpl
Default implementation of WaspSecurity SPI. |
Constructor Summary | |
WaspSecurity()
|
Method Summary | |
static Credentials |
acquireClientCredentials(java.lang.String userName,
java.lang.String authData,
java.lang.String authenticationMechanism)
Creates client credentials for given name, password and authentication mechanism. |
static Credentials |
acquireServerCredentials(java.lang.String userName,
java.lang.String authData,
java.lang.String authenticationMechanism)
Creates server credentials for given name, password and authentication mechanism. |
static void |
checkPermission(java.security.Permission perm)
Determines whether the access request indicated by the specified permission should be allowed or denied, based on the security WSO2 SOA Enablement Server policy currently in effect. |
static java.lang.String[] |
getAcceptingProviders(ServiceEndpointContext serviceEndpointContext)
Returns names of the current service endpoint server accepting security providers or current execution context accepting security providers, if the parameter is null
used for SOAP communication. |
static java.lang.String[] |
getAnRequirementsForEndpoint(java.lang.String serverURL,
java.lang.String serviceEndpointPath)
Returns authentication requirements for specified service endpoint in the context of server URL. |
static java.lang.String[] |
getAnRequirementsForEndpoint(java.lang.String serverURL,
java.lang.String serviceEndpointPath,
boolean isGetTransportMethod)
Returns authentication requirements for specified web service endpoint in the context of server URL and transport method. |
static Credentials[] |
getCredentials(ServiceClient serviceClient)
Returns array of Credentials which were previously set on service client context or execution context, if the first parameter is null . |
static java.security.PermissionCollection |
getDefaultPrincipalPermissions()
Returns set of permissions for unauthenticated users; in other words, permissions for default principal. |
static java.lang.String |
getInitiatingProvider(ServiceClient serviceClient)
Returns initiating provider, which was previously set on ServiceClient instance or execution context, if the parameter
is null . |
static java.lang.String |
getInitiatingProvider(ServiceEndpointContext serviceEndpointContext)
Returns initiating provider, which was previously set on ServiceClient
or execution context, if the parameter is null . |
static java.util.Map |
getInstalledSecurityInfo()
Returns metadata information about installed security. |
static java.security.Principal |
getInvokerFirstPrincipal()
This method can be invoked on the service side to determine service invoker identified as his first principal. |
static java.util.Iterator |
getInvokerPrincipals()
This method can be on the service side to determine service invoker principals. |
static javax.security.auth.Subject |
getInvokerSubject()
Returns subject representing invoker. |
static Configurable |
getProviderProperties(ServiceClient serviceClient,
java.lang.String providerName)
Returns properties of security providers that are determined by the given instance of Configurable. |
static Configurable |
getProviderProperties(ServiceEndpointContext serviceEndpointContext,
java.lang.String providerName)
Returns properties of security providers that are determined by the given instance of Configurable. |
static java.lang.Class |
getProviderPropertiesIface(java.lang.String providerName)
Returns configuration class of the given provider. |
static void |
init(WaspSecurity.SPI instance)
This method is used to set SPI instance of this class. |
static boolean |
isAppCredentialsSet()
Returns true if the application code already sets credentials, false otherwise. |
static boolean |
isAuthorizationRequired(ServiceEndpointContext serviceEndpointContext)
It determines whether automatic authorization for given service endpoint context is on. |
static boolean |
isInitialized()
Tests if the singleton instance was initialized by custom implementation. |
static java.util.Properties |
modifyLookupProperties(java.util.Properties lookupProperties)
This method is usedto modify security properties for lookup, like HTTP proxy name and password. |
static void |
resetCredentials()
Resets client credentials in the current execution context. |
static void |
setAcceptingProviders(ServiceEndpointContext serviceEndpointContext,
java.lang.String[] providerNames)
Sets accepting security providers for the given service endpoint context. |
static void |
setAuthorizationRequired(ServiceEndpointContext serviceEndpointContext,
boolean authorizationRequired)
Turns on or off automatic authorization for given service endpoint context. |
static void |
setCredentials(ServiceClient serviceClient,
Credentials[] creds)
Sets Credentials for given ServiceClient instance or whole execution context, if
the first parameter is null . |
static void |
setCredentials(ServiceEndpointContext serviceEndpointContext,
Credentials[] creds)
Sets credentials for service endpoint context or default service execution context. |
static void |
setInitiatingProvider(ServiceClient serviceClient,
java.lang.String providerName)
Sets initiating provider to ServiceClient instance or to the execution
context depending on the parameter value. |
static void |
setInitiatingProvider(ServiceEndpointContext serviceEndpointContext,
java.lang.String providerName)
Sets initiating security provider for the given service endpoint context. |
static void |
setProviderProperties(ServiceClient serviceClient,
Configurable config,
java.lang.String providerName)
Sets properties of security providers that are determined by the given instance of Configurable. |
static void |
setProviderProperties(ServiceClient serviceClient,
java.util.Map properties)
Deprecated. Use setProviderProperties(ServiceClient serviceClient, Configurable config, String providerName) instead. |
static void |
setProviderProperties(ServiceEndpointContext serviceEndpointContext,
Configurable config,
java.lang.String providerName)
Sets properties of security providers that are determined by the given instance of Configurable. |
static void |
setProviderProperties(ServiceEndpointContext serviceEndpointContext,
java.util.Map properties)
Deprecated. Use setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName) instead. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String HTTP_BASIC_USER_NAME
Properties
object passed to lookup operation. If
the pair HTTP_BASIC_USER_NAME
and its value is
presented for lookuping operation, the username value will be
used for HTTP Basic authentication.
public static final java.lang.String HTTP_BASIC_PASSWORD
Properties
object passed to lookup operation. If
the pair HTTP_BASIC_PASSWORD
and its value is
presented for lookuping operation, the password value will be
used for HTTP Basic authentication.
public static final java.lang.String HTTPS_REQUEST_CHUNKING
Properties
object passed to lookup operation.
This property has string value equal to "true" if there is
a request chunking required. The default value is "false",
no request chunking.
public static final java.lang.String HTTPS_PROXY_USER_NAME
Registry
in the map contextData
which is paramenter
of the operation Registry.lookup(String,Class,String,java.util.Map)
.
public static final java.lang.String HTTPS_PROXY_PASSWORD
Registry
in the map contextData
which is paramenter
of the operation Registry.lookup(String,Class,String,java.util.Map)
.
public static final java.lang.String HTTPS_BASIC_USER_NAME
Properties
object passed to lookup operation. If
the pair HTTPS_BASIC_USER_NAME
and its value is
presented for lookuping operation, the username value will be
used to http basic authenticate.
public static final java.lang.String HTTPS_BASIC_PASSWORD
Properties
object passed to lookup operation. If
the pair HTTPS_BASIC_PASSWORD
and its value is
presented for lookuping operation, the password value will be
used to basic authenticate.
public static final java.lang.String AUTHENTICATION_SUPPORTED
getInstalledSecurityInfo
method.
You can test if authetntication is supported using this key.
public static final java.lang.String AUTHORIZATION_SUPPORTED
getInstalledSecurityInfo
method.
You can test if authorization is supported using this key.
public static final java.lang.String SYSTINET_KRB_PRIVATE_STATE
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
true
public static final java.lang.String SYSTINET_KRB_QOP_VALUE
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
0
public static final java.lang.String SYSTINET_KRB_REQ_MIC
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
false
public static final java.lang.String SYSTINET_REQ_MUTUAL_AUTH
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
true
public static final java.lang.String SYSTINET_REQ_CONF
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
true
public static final java.lang.String SYSTINET_KERBEROS_SERVICE_REALM
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
public static final java.lang.String SYSTINET_SOAPDSIG_CANONICALIZATION_METHOD
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
public static final java.lang.String SYSTINET_SOAPDSIG_DIGEST_METHOD
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
public static final java.lang.String SYSTINET_SOAPDSIG_SIGNATURE_METHOD
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
public static final java.lang.String SYSTINET_SOAPDSIG_TRANSFORMS
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
public static final java.lang.String SYSTINET_SOAPDSIG_KEYNAME
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
public static final java.lang.String SYSTINET_SOAPDSIG_SIGNATURE_TYPE
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
or setProviderProperties(org.systinet.wasp.webservice.ServiceClient, org.idoox.config.Configurable, java.lang.String)
instead.
public static final java.lang.String STUB_CONTEXT_SECURITY_PROVIDER
public static final java.lang.String STUB_CONTEXT_CREDENTIALS
public static final java.lang.String SEC_PROV_PREFS_CONF_NAME
Constructor Detail |
public WaspSecurity()
Method Detail |
public static void init(WaspSecurity.SPI instance)
RuntimeException
is thrown.
instance
- instace of WaspSecurity SPI
java.lang.RuntimeException
- WaspSecurity is already initializedpublic static boolean isInitialized()
true
if custom implementation was used, false
otherwise.public static java.util.Map getInstalledSecurityInfo()
"AUTHENTICATION_SUPPORTED"
"true"
means that authentication is supported."AUTHORIZATION_SUPPORTED"
"true"
means that authorization is supported.
public static java.security.PermissionCollection getDefaultPrincipalPermissions() throws java.security.AccessControlException
java.security.AccessControlException
- security policy disallows to get default principal permissionspublic static java.lang.String getInitiatingProvider(ServiceClient serviceClient)
ServiceClient
instance or execution context, if the parameter
is null
.
If none was set, this method returns null
.
serviceClient
- ServiceClient
instance, or null
to use execution context
null
if no provider is usedpublic static java.lang.String getInitiatingProvider(ServiceEndpointContext serviceEndpointContext)
ServiceClient
or execution context, if the parameter is null
.
If none was set, this method returns null
.
serviceEndpointContext
- service endpoint context, or null
to use execution context
null
if no provider is usedpublic static java.lang.String[] getAcceptingProviders(ServiceEndpointContext serviceEndpointContext)
null
used for SOAP communication.
serviceEndpointContext
- service endpoint context or null
to use execution context
public static boolean isAppCredentialsSet()
true
if the application code already sets credentials, false
otherwise.
This method is used by WSO2 SOA Enablement Server Core to determine whether default credentials should be obtained. So this code
is neccessary according to priorities of credential obtaining. Credentials set by application MUST
be used first, if no credentials were set, WSO2 SOA Enablement Server is allowed to create and set default credentials using the
aquireCredentials
and
setCredentials((Object)null, Credentials[])
methods. The
aquireCredentials
is invoked using System properties
wasp.username
, wasp.password
and wasp.securityMechanism
.
Note, that WSO2 SOA Enablement Server invokes this method only in the case that wasp.username
System property is set. The implemenation provided inside this methods checks if
the getCredentials(null)
returns some credentials (array
of length greater than zero) to determine return value.
true
if application were set already client credentials, false
otherwise.public static java.util.Properties modifyLookupProperties(java.util.Properties lookupProperties)
HTTP_BASIC_USER_NAME
HTTP_BASIC_PASSWORD
lookupProperties
- current lookup properties, may be null
null
public static java.security.Principal getInvokerFirstPrincipal()
null
, if invoker identity
is unknowngetInvokerPrincipals()
,
getInvokerSubject()
public static java.util.Iterator getInvokerPrincipals()
null
if the invoker identity is unknowngetInvokerFirstPrincipal()
,
getInvokerSubject()
public static javax.security.auth.Subject getInvokerSubject()
null
, if the invoker is unknowngetInvokerFirstPrincipal()
,
getInvokerPrincipals()
public static void setAuthorizationRequired(ServiceEndpointContext serviceEndpointContext, boolean authorizationRequired) throws java.security.NoSuchProviderException
serviceEndpointContext
- service endpoint contextauthorizationRequired
- true
, if authorization is required, false
is it is not
java.security.NoSuchProviderException
- authorization settings cannot be setpublic static boolean isAuthorizationRequired(ServiceEndpointContext serviceEndpointContext) throws java.security.NoSuchProviderException
serviceEndpointContext
- service context
true
, if authorization is required, false
is it is not
java.security.NoSuchProviderException
- authorization settings cannot be determinedpublic static void setAcceptingProviders(ServiceEndpointContext serviceEndpointContext, java.lang.String[] providerNames) throws java.security.NoSuchProviderException
null
.
serviceEndpointContext
- service endpoint context, it can be null
to set them
to current webservice endpoint contextproviderNames
- names of security providers, empty array and null
value can be accepted to set no providers
java.security.NoSuchProviderException
- if there is some provider, which is not configured or
not accessiblepublic static void setInitiatingProvider(ServiceEndpointContext serviceEndpointContext, java.lang.String providerName) throws java.security.NoSuchProviderException
null
.
serviceEndpointContext
- service endpoint context, it can be null
to set them
to current service execution contextproviderName
- provider name or null
to set no provider
java.security.NoSuchProviderException
- the provider, identified by providerName, is not configured or
not accessiblepublic static void setCredentials(ServiceEndpointContext serviceEndpointContext, Credentials[] creds)
serviceEndpointContext
- service endpoint context, or null
to use
current service contextcreds
- credentials to set to endpoint context, empty array or null
value can be used to reset credentials associated with service endpoint contextpublic static Credentials acquireClientCredentials(java.lang.String userName, java.lang.String authData, java.lang.String authenticationMechanism) throws java.security.NoSuchProviderException
setCredentials(Object,Credentials[])
method.
If credentials with a given name, password, and authenticationMechanism can not be created,
NoSuchProviderException or RuntimeWrappedException is thrown.
userName
- user name, can be null
authData
- authentication data, e.g. password of the user, can be null
authenticationMechanism
- authentication mechanism (e.g.
"SSL" or "HttpBasic")
java.security.NoSuchProviderException
- if there is no provider for
specified authentication mechanismpublic static Credentials acquireServerCredentials(java.lang.String userName, java.lang.String authData, java.lang.String authenticationMechanism) throws java.security.NoSuchProviderException
setCredentials(WSContext,Credentials[])
method.
If credentials with a given name, password, and authenticationMechanism can not be created,
NoSuchProviderException or RuntimeWrappedException is thrown.
userName
- user name or alias, can be null
authData
- authentication data, e.g. password of the user, can be null
authenticationMechanism
- authentication mechanism (e.g.
"SSL" or "HttpBasic")
null
if credentials cannot be created
java.security.NoSuchProviderException
- if there is no provider for
specified authentication mechanismpublic static Credentials[] getCredentials(ServiceClient serviceClient)
null
.
If none were set, this method returns null
.
serviceClient
- service client, or null
to
to use execution context
serviceClient
, it may return null
.public static void setCredentials(ServiceClient serviceClient, Credentials[] creds)
ServiceClient
instance or whole execution context, if
the first parameter is null
. This method only sets credentials.
serviceClient
- service client, or null
to use
execution contextcreds
- array of Credentials to be set for given serviceClient
, may be null
setInitiatingProvider(ServiceClient,String)
public static void setInitiatingProvider(ServiceClient serviceClient, java.lang.String providerName) throws java.security.NoSuchProviderException
ServiceClient
instance or to the execution
context depending on the parameter value.
serviceClient
- service client, can be null
to set
default client security providerproviderName
- provider name or null
to set no provider
java.security.NoSuchProviderException
- if there is no provider for
specified authentication mechanismpublic static void setProviderProperties(ServiceClient serviceClient, java.util.Map properties)
setProviderProperties(ServiceClient serviceClient, Configurable config, String providerName)
instead.
true
0
false
true
true
SignatureCreator
.
serviceClient
- service client, cannot be null
properties
- properties to setpublic static void setProviderProperties(ServiceEndpointContext serviceEndpointContext, java.util.Map properties)
setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, String providerName)
instead.
true
0
false
true
true
SignatureCreator
.
serviceEndpointContext
- service endpoint context, cannot be null
properties
- properties to setpublic static void setProviderProperties(ServiceClient serviceClient, Configurable config, java.lang.String providerName) throws java.security.NoSuchProviderException
config
object is then narrowed to corresponding
configuration interface.
This method is usually used for configuration, integration,... In most cases, users
needn't to use this method.
serviceClient
- service client, cannot be null
config
- the configurable object that determines provider propertiesproviderName
- name of the security provider to set the properties
java.security.NoSuchProviderException
public static void setProviderProperties(ServiceEndpointContext serviceEndpointContext, Configurable config, java.lang.String providerName) throws java.security.NoSuchProviderException
config
object is then narrowed to corresponding
configuration interface.
This method is usually used for configuration, integration,... In most cases, users
needn't to use this method.
serviceEndpointContext
- service endpoint context, cannot be null
config
- the configurable object that determines provider propertiesproviderName
- name of the security provider to set the properties
java.security.NoSuchProviderException
public static Configurable getProviderProperties(ServiceEndpointContext serviceEndpointContext, java.lang.String providerName)
config
object is then narrowed to corresponding
configuration interface.
This method is usually used for configuration, integration,... In most cases, users
needn't to use this method.
serviceEndpointContext
- service endpoint context, cannot be null
providerName
- name of the security provider to get the properties
Configurable
instancepublic static Configurable getProviderProperties(ServiceClient serviceClient, java.lang.String providerName)
config
object is then narrowed to corresponding
configuration interface.
This method is usually used for configuration, integration,... In most cases, users
needn't to use this method.
serviceClient
- service client, cannot be null
providerName
- name of the security provider to get the properties
Configurable
instancepublic static void resetCredentials()
public static java.lang.String[] getAnRequirementsForEndpoint(java.lang.String serverURL, java.lang.String serviceEndpointPath) throws WebServiceLookupException
WebServiceLookupException
can be thrown.
serverURL
- server URL (e.g. "http://localhost:6060/wasp")serviceEndpointPath
- service endpoint path (e.g.
"/admin/DeployService"), can be null
to query default authentication requirements
WebServiceLookupException
- unable to lookup the service providing endpoint security informationpublic static java.lang.String[] getAnRequirementsForEndpoint(java.lang.String serverURL, java.lang.String serviceEndpointPath, boolean isGetTransportMethod) throws WebServiceLookupException
WebServiceLookupException
can be thrown.
serverURL
- server URL (e.g. "http://localhost:6060"); can be null
to use
local serverserviceEndpointPath
- service endpoint path (e.g.
"/admin/DeployService"), can be null
to query default authentication requirementsisGetTransportMethod
- true
in the case that it must consider GET
transport, false
otherwise
WebServiceLookupException
- unable to lookup the service providing endpoint security informationpublic static void checkPermission(java.security.Permission perm) throws java.security.AccessControlException
AccessControlException
otherwise.
Default implementation allows every permission.
perm
- the requested permission (should not be null
)
java.security.AccessControlException
- if the specified permission
is not permitted, based on the current security policy.public static java.lang.Class getProviderPropertiesIface(java.lang.String providerName) throws java.security.NoSuchProviderException
providerName
- a given provider name
java.security.NoSuchProviderException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |