Class: JiraStrategyService
strategies/jira/jira.service.JiraStrategyService
Base class for all strategies.
Param
The name of the strategy
Param
The service to use for strategy instances
Param
The service to use for strategies
Param
Whether the strategy can be used for login and registration of new users (does not affect registering additional accounts)
Param
Whether the strategy can be used to sync with external services
Param
Whether the strategy needs a redirect flow for login
Param
Whether the strategy allows implicit signup
Param
Whether the strategy forces the use of a suggested username
Hierarchy
↳
JiraStrategyService
Constructors
constructor
• new JiraStrategyService(strategiesService
, strategyInstanceService
, loginDataService
, stateJwtService
, activeLoginService
)
Parameters
Name | Type |
---|---|
strategiesService | StrategiesService |
strategyInstanceService | StrategyInstanceService |
loginDataService | UserLoginDataService |
stateJwtService | JwtService |
activeLoginService | ActiveLoginService |
Overrides
StrategyUsingPassport.constructor
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:19
Properties
activeLoginService
• Private
Readonly
activeLoginService: ActiveLoginService
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:25
allowsImplicitSignup
• Readonly
allowsImplicitSignup: boolean
= false
Inherited from
StrategyUsingPassport.allowsImplicitSignup
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:50
canLoginRegister
• Readonly
canLoginRegister: boolean
= true
Inherited from
StrategyUsingPassport.canLoginRegister
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:47
canSync
• Readonly
canSync: boolean
= false
Inherited from
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:48
forceSuggestedUsername
• Readonly
forceSuggestedUsername: boolean
= false
Inherited from
StrategyUsingPassport.forceSuggestedUsername
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:51
loggerJira
• Private
Readonly
loggerJira: Logger
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:18
loginDataService
• Private
Readonly
loginDataService: UserLoginDataService
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:22
needsRedirectFlow
• Readonly
needsRedirectFlow: boolean
= false
Inherited from
StrategyUsingPassport.needsRedirectFlow
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:49
stateJwtService
• Protected
Readonly
stateJwtService: JwtService
Inherited from
StrategyUsingPassport.stateJwtService
Defined in
gropius-login-service/backend/src/strategies/StrategyUsingPassport.ts:17
strategiesService
• Protected
Readonly
strategiesService: StrategiesService
Inherited from
StrategyUsingPassport.strategiesService
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:46
strategyInstanceService
• Protected
Readonly
strategyInstanceService: StrategyInstanceService
Inherited from
StrategyUsingPassport.strategyInstanceService
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:45
typeName
• Readonly
typeName: string
Inherited from
StrategyUsingPassport.typeName
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:44
Accessors
acceptsVariables
• get
acceptsVariables(): StrategyVariable
[]
Returns
Inherited from
StrategyUsingPassport.acceptsVariables
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:155
instanceConfigSchema
• get
instanceConfigSchema(): Record
<string
, Schema
>
Returns
Record
<string
, Schema
>
Overrides
StrategyUsingPassport.instanceConfigSchema
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:30
updateActions
• get
updateActions(): StrategyUpdateAction
[]
Returns
Inherited from
StrategyUsingPassport.updateActions
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:159
Methods
checkAndExtendInstanceConfig
▸ Protected
checkAndExtendInstanceConfig(instanceConfig
): object
Chechs the given config is valid for a jira (or jira enterprise)
Needed parameters
- imsTemplatedFieldsFilter containing:
- root-url: The URL of the jira root endpoint, must be provided.
- authorizationUrl: Oauth authorization URL. Optional, default: "https://jira.com/login/oauth/authorize"
- tokenUrl: Oauth token url. Optional, default: "https://jira.com/login/oauth/access_token"
- userProfileUrl: API URL to request user profile info from. Needs to be specified for GitHib Enterprise instances. Optional
- clientId: Id of Jira oauth app. Optional, default: GROPIUS_OAUTH_CLIENT_ID config variable
- clientSecret: secret of Jira oaut app. Optional, default: GROPIUS_OAUTH_CLIENT_SECRET config value
- callbackUrl: Oauth callback url. Should be [URL]/authenticate/:id/callback. Optional, default empty
Parameters
Name | Type | Description |
---|---|---|
instanceConfig | object | The instance config for a jira strategy instance to check |
Returns
object
The extended config (with default parameters for the global jira) if check successful
Overrides
StrategyUsingPassport.checkAndExtendInstanceConfig
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:62
createOrUpdateNewInstance
▸ createOrUpdateNewInstance(input
, instanceToUpdate?
): Promise
<StrategyInstance
>
Parameters
Name | Type |
---|---|
input | UpdateStrategyInstanceInput | CreateStrategyInstanceInput |
instanceToUpdate? | StrategyInstance |
Returns
Promise
<StrategyInstance
>
Inherited from
StrategyUsingPassport.createOrUpdateNewInstance
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:100
createPassportStrategyInstance
▸ createPassportStrategyInstance(strategyInstance
): Strategy
Parameters
Name | Type |
---|---|
strategyInstance | StrategyInstance |
Returns
Strategy
Overrides
StrategyUsingPassport.createPassportStrategyInstance
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:251
existsInstanceClearName
▸ existsInstanceClearName(name
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
name | string |
Returns
Promise
<boolean
>
Inherited from
StrategyUsingPassport.existsInstanceClearName
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:140
getAdditionalPassportOptions
▸ Protected
getAdditionalPassportOptions(strategyInstance
, authStateData
): AuthenticateOptions
Parameters
Name | Type |
---|---|
strategyInstance | StrategyInstance |
authStateData | AuthStateServerData & OAuthAuthorizeServerState |
Returns
AuthenticateOptions
Inherited from
StrategyUsingPassport.getAdditionalPassportOptions
Defined in
gropius-login-service/backend/src/strategies/StrategyUsingPassport.ts:38
getAllInstances
▸ getAllInstances(): Promise
<StrategyInstance
[]>
Returns
Promise
<StrategyInstance
[]>
Inherited from
StrategyUsingPassport.getAllInstances
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:144
getCensoredInstanceConfig
▸ getCensoredInstanceConfig(instance
): object
Returns the instance config of the strategy instance, but with sensitive data censored.
WARNING: The result of this function WILL be exposed to the user.
Parameters
Name | Type | Description |
---|---|---|
instance | StrategyInstance | The strategy instance for which to get the censored instance config |
Returns
object
The censored instance config
Overrides
StrategyUsingPassport.getCensoredInstanceConfig
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:278
getImsTemplatedValuesForStrategyInstance
▸ getImsTemplatedValuesForStrategyInstance(instance
): object
| Promise
<object
>
Returns the object containing the templated fields and their values that an IMS needs to match, in order to be considered tha IMS that is represented by the strategy instance given. Values will be compared field by field with the templated values of the IMS.
The fields id
, name
and description
of the returned object will not be compared to the templated values,
but instead to the actual fields of the IMS with those respective names.
For example: The API-Url must match in order for a GitHub IMS belonging to a GitHub strategy instance
Can/Should be overridden by strategies capable of sync.
Default implementation returns imsTemplatedFieldsFilter
of instance config
Parameters
Name | Type | Description |
---|---|---|
instance | StrategyInstance | The strategy instance for which the templated values should be retuned |
Returns
object
| Promise
<object
>
An object which, if it matches the templated fields of an IMS, the given instance is the matching strategy instance for that IMS Null if the strategy does not sync
Inherited from
StrategyUsingPassport.getImsTemplatedValuesForStrategyInstance
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:191
getImsUserTemplatedValuesForLoginData
▸ getImsUserTemplatedValuesForLoginData(loginData
): object
Returns the object containing the templated fields and their values that an IMSUser needs to match,
in order to be considered an IMSUser that belongs to the given loginData
(i.e. the IMS is a login of the user of this login data on the ims of this login data)
The fields id
, username
, displayName
and email
of the returned object
will not be compared to the templated values,
but instead to the actual fields of the IMSUser with those respective names.
For example: The username on GitHub must match the username in the login data.
Can/Should/Must be overridden by strategies capable of sync.
Default implementation returns the loginData.data
field unchanged
Parameters
Name | Type | Description |
---|---|---|
loginData | UserLoginData | The login data for which the templated field values should be returned, representing a login of the user using a strategy instance |
Returns
object
An object which, if it matches the templated fields of an IMSUser, the given loginData is the matching login for that IMSUser Null if the strategy does not sync
Overrides
StrategyUsingPassport.getImsUserTemplatedValuesForLoginData
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:188
getInstanceById
▸ getInstanceById(id
): Promise
<StrategyInstance
>
Parameters
Name | Type |
---|---|
id | string |
Returns
Promise
<StrategyInstance
>
Inherited from
StrategyUsingPassport.getInstanceById
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:148
getLoginDataDataForImsUserTemplatedFields
▸ getLoginDataDataForImsUserTemplatedFields(imsUser
): object
| Promise
<object
>
Does the opposite of getImsUserTemplatedValuesForLoginData
.
Returns an object that needs to match the data field of a LoginData
in order for the IMSUser to be considerd matching the login data.
The imsUserTemplatedFields
should also contain the fields
id
, username
, displayName
and email
directly of the IMSUser
in addition to the templated fields and values.
For example: Given templated fields of an IMSUser containing its username, this should return the login data object that also matches the user with that username
Can/Should/Must be overridden by strategies capable of sync.
Default implementation returns the imsUserTemplatedFields
unchanged
Parameters
Name | Type | Description |
---|---|---|
imsUser | object | Templated fields and values as well as the fields id , username , displayName and email of the IMSUser. |
Returns
object
| Promise
<object
>
An object, that the .data
field of a login data needs to match.
Overrides
StrategyUsingPassport.getLoginDataDataForImsUserTemplatedFields
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:197
getLoginDataDescription
▸ getLoginDataDescription(loginData
): Promise
<string
>
Gets a description of the login data, e.g. a username or email.
Parameters
Name | Type | Description |
---|---|---|
loginData | UserLoginData | The login data for which to get the description |
Returns
Promise
<string
>
A description of the login data
Overrides
StrategyUsingPassport.getLoginDataDescription
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:274
getSyncDataForLoginData
▸ getSyncDataForLoginData(loginData
): Promise
<{ [key: string]
: any
; token
: string
}>
Parameters
Name | Type |
---|---|
loginData | UserLoginData |
Returns
Promise
<{ [key: string]
: any
; token
: string
}>
Overrides
StrategyUsingPassport.getSyncDataForLoginData
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:121
getUserDataSuggestion
▸ getUserDataSuggestion(loginData
): Object
For a given login data return data that has been retrieved from the authentication source with which to prefill the input fields for the user registration
WARNING: Does not check wether the returned data is valid or e.g. a username is unique. This is purely a data mapper.
Parameters
Name | Type | Description |
---|---|---|
loginData | UserLoginData | The login data of the authentication for which to retrieve the data |
Returns
Object
Suggestions for the user data based on the login data. NOT checked!
Name | Type |
---|---|
displayName? | string |
email? | string |
username? | string |
Overrides
StrategyUsingPassport.getUserDataSuggestion
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:203
handleAction
▸ handleAction(loginData
, name
, data
): Promise
<void
>
Handles an action that was triggered by the user. Actions are defined via updateActions.
Parameters
Name | Type | Description |
---|---|---|
loginData | UserLoginData | the login data of the user that triggered the action |
name | string | the name of the action |
data | Record <string , any > | the data for the action |
Returns
Promise
<void
>
Inherited from
StrategyUsingPassport.handleAction
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:298
passportUserCallback
▸ Protected
passportUserCallback(strategyInstance
, accessToken
, refreshToken
, profile
, done
): Promise
<void
>
Finds the login data for the given strategy instance and the valued returned by Jira. To be executed as passport user callback.
Parameters
Name | Type | Description |
---|---|---|
strategyInstance | StrategyInstance | The instance of the Jira strategy for which to find the user |
accessToken | string | The access token returned by Jira |
refreshToken | string | The refreshToken returned by Jira |
profile | any | The profile data for the logged in user returned by Jira |
done | (err : any , user : false | AuthResult , info : any ) => void | The done function to be called with the found login data or the error |
Returns
Promise
<void
>
Defined in
gropius-login-service/backend/src/strategies/jira/jira.service.ts:225
performAuth
▸ performAuth(strategyInstance
, state
, req
, res
): Promise
<PerformAuthResult
>
Parameters
Name | Type |
---|---|
strategyInstance | StrategyInstance |
state | AuthStateServerData & OAuthAuthorizeServerState |
req | any |
res | any |
Returns
Promise
<PerformAuthResult
>
Inherited from
StrategyUsingPassport.performAuth
Defined in
gropius-login-service/backend/src/strategies/StrategyUsingPassport.ts:45
toJSON
▸ toJSON(): Object
Returns
Object
Name | Type |
---|---|
acceptsVariables | StrategyVariable [] |
allowsImplicitSignup | boolean |
canLoginRegister | boolean |
canSync | boolean |
instanceConfigSchema | Record <string , Schema > |
needsRedirectFlow | boolean |
typeName | string |
updateActions | StrategyUpdateAction [] |
Inherited from
Defined in
gropius-login-service/backend/src/strategies/Strategy.ts:309